- 装配日期:
+ 装配时间:
|
@@ -188,6 +195,7 @@
});
// 下拉框加载
+ reloadline_station();
//reload_station_no('#station_no');
reload_part_no('#part_no');
//新增按钮点击
@@ -285,6 +293,24 @@
return getTime(unixtime).substring(0, 19);
}
},
+ {
+ field: 'State', title: '状态', sortable: 'true', width: 10,
+ formatter: function (value) {
+ if (value == 0) {
+ return "新建";
+ }
+ else if (value == 1) {
+ return "启用";
+ }
+ else if (value == 2) {
+ return "暂停";
+ }
+ else {
+ return "完成";
+ }
+ }
+ },
+
]],
@@ -308,14 +334,12 @@
function SaveInfo(isEdit) {
var ID = isEdit == true ? PrimaryID : 0;
- var PartNo = $('#part_no').combo('getValue');
- //var StationID = $('#station_no').combo('getValue');
- var OrderDate = $('#OrderDate').datebox('getValue');
- //var IsOneMore = checkboxValue($('#IsOneMore'));
+ var PartNo = $('#part_no').combo('getValue');
+ var OrderDate = $('#OrderDate').datebox('getValue');
var OrderCount = $('#OrderCount').val();
var OrderName = $('#OrderName').val();
- var Line = $('#Line').val();
- var Station = $('#Station').val();
+ var Line = $('#line_id').combo('getText');
+ var Station = $('#station_id').combo('getText');
if (PartNo == "") {
$.messager.alert('提示', '零件不能为空,请重新输入', 'warning');
@@ -381,12 +405,14 @@
function SearchInfo() {
var PartNo = $('#part_no_s').val();
+ var State = $('#state_s').val();
var StartTime = $('#start_time').datebox('getValue');
var EndTime = $('#end_time').datebox('getValue');
dg.datagrid({
queryParams: {
PartNo,
+ State,
StartTime,
EndTime
}
@@ -413,8 +439,8 @@
//toggleChecked('#IsOneMore', row.IsOneMore);
$('#OrderCount').val(row.OrderCount);
$('#OrderName').val(row.OrderName);
- $('#Line').val(row.Line);
- $('#Station').val(row.Station);
+ $('#line_id').combobox('select', row.Line);
+ $('#station_id').combobox('select', row.Station);
var pa = /.*\((.*)\)/;
var unixtime = row.OrderDate.match(pa)[1].substring(0, 10);
$('#OrderDate').datetimebox('setValue', getTime(unixtime).substring(0, 19));
@@ -467,8 +493,8 @@
$('#OrderDate').datebox('setValue', '');
$('#OrderCount').val('');
$('#OrderName').val('');
- $('#Line').val('');
- $('#Station').val('');
+ $('#line_id').combo('clear');
+ $('#station_id').combo('clear');
}
function toggleChecked(id, checked) {
@@ -482,7 +508,7 @@
* 加载产品下拉信息
**/
function reload_part_no(ctl) {
- base_reload_combobox(ctl, '/HttpHandlers/ProductHandler.ashx?method=GetComboboxProduct4');
+ base_reload_combobox(ctl, '/HttpHandlers/ProductHandler.ashx?method=QueryForCombobox&ProductTypeNo=6000');
}
function reload_station_no(ctl) {
@@ -507,6 +533,27 @@
document.body.appendChild(temp_form);
temp_form.submit();
}
+
+ function reloadline_station() {
+
+ $('#line_id').combobox({
+ url: '/HttpHandlers/LineHandler.ashx?method=QueryForCombobox',
+ onLoadSuccess: function () {
+ var val = $(this).combobox('getData');
+ $(this).combobox('select', val[0].LineID);
+ },
+ onSelect: function (row) {
+ $('#station_id').combobox({
+ url: '/HttpHandlers/StationHandler.ashx?method=QueryForComboboxByLineIDNew&&LineID=' + row.LineID + '',
+ onLoadSuccess: function () {
+ //var val = $(this).combobox('getData');
+ //$(this).combobox('select', val[0].ID);
+ },
+
+ });
+ }
+ });
+ }
diff --git a/MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml b/MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..0246c1b
--- /dev/null
+++ b/MESWebSite/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,17 @@
+
+
+
+
+ false
+ false
+ true
+ Release
+ Any CPU
+ FileSystem
+ D:\发布\Mes
+ FileSystem
+ <_TargetId>Folder
+
+
\ No newline at end of file
diff --git a/WebService/AppWebservice.asmx.cs b/WebService/AppWebservice.asmx.cs
index 071dd5c..9487064 100644
--- a/WebService/AppWebservice.asmx.cs
+++ b/WebService/AppWebservice.asmx.cs
@@ -1,6 +1,9 @@
using System.Collections.Generic;
using System.Data;
+using System.Linq;
using System.Reflection;
+using System.Runtime.Remoting.Contexts;
+using System.Text;
using System.Web.Script.Services;
using System.Web.Services;
using Tools;
@@ -25,6 +28,188 @@ namespace Webservice
return "Hello World";
}
+
+ ///
+ /// 箱码与总成码关系绑定
+ ///
+ ///
+ ///
+ ///
+ ///
+ [WebMethod]
+ [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
+ public void BindBoxCodeAndBarCode(string app_id, string boxCode, string barCode, string sign)
+ {
+ string errorReason = "";
+
+ JsonModel model = new JsonModel();
+ model.Result = "0";
+ model.ResultType = "Result";
+ model.ResultRowsCount = "0";
+ model.ErrReason = errorReason;
+ model.DataList = null;
+
+ LogHelper.WriteSysLogBase("箱码与总成码关系绑定,入参boxCode=" + boxCode + ",barCode=" + barCode, MethodBase.GetCurrentMethod().Name);
+ Context.Response.ContentType = "application/json; charset=utf-8";
+
+ #region 参数判断
+ //if (string.IsNullOrWhiteSpace(app_id))
+ //{
+ // model.ErrReason = "缺少必要传入参数 app_id";
+ // Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ // return;
+ //}
+ if (string.IsNullOrWhiteSpace(boxCode))
+ {
+ model.ErrReason = "缺少必要传入参数 boxCode";
+ Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ return;
+ }
+ //箱码格式验证
+ var boxCodeList = boxCode.Split(';');
+ if (!boxCode.Contains("PN") || !boxCode.Contains("PKG") || !boxCode.Contains("QTY") || boxCodeList.Length != 7 || boxCodeList[0].Length != 16 || boxCodeList[1].Length != 12 || boxCodeList[5].Length != 16)
+ {
+ model.ErrReason = "箱码标签格式不对";
+ Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ return;
+ }
+ //if (string.IsNullOrWhiteSpace(barCode))
+ //{
+ // model.ErrReason = "缺少必要传入参数 barCode";
+ // Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ // return;
+ //}
+ //if (string.IsNullOrWhiteSpace(sign))
+ //{
+ // model.ErrReason = "缺少必要传入参数 sign";
+ // Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ // return;
+ //}
+ //bool access = Function.AppIDIsRight(app_id.Trim());
+ //if (!access)
+ //{
+ // model.ErrReason = "APP接口调用标识不正确 远程服务器拒绝了此次连接请求";
+ // Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ // return;
+ //}
+ //string[] param = { Function.app_secret.Trim(), boxCode.Trim(), barCode.Trim() };
+ //bool paramIsRight = Function.signIsRight(param, sign);
+ //if (!paramIsRight)
+ //{
+ // model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
+ // Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ // return;
+ //}
+ #endregion
+
+ string errorReasonBoxData = "";
+ DataTable dt = Function.GetCodeRecords(boxCode, out errorReasonBoxData);
+ List listInfo = new List();
+
+ if (dt.Rows.Count < 1)
+ {
+
+ model.ResultRowsCount = "0";
+ model.DataList = null;
+ if (string.IsNullOrEmpty(errorReasonBoxData))
+ {
+ model.Result = "1";
+ model.ErrReason = "";
+ }
+ else
+ {
+ model.Result = "0";
+ model.ErrReason = errorReasonBoxData;
+ }
+ }
+ else
+ {
+ listInfo = Tools.DataTableToList.ConvertTo(dt);
+ model.ResultRowsCount = listInfo.Count.ToString();
+ model.DataList = listInfo;
+ }
+ if(!string.IsNullOrEmpty(barCode))
+ {
+ #region 数据合法性判断
+ //总成码格式验证
+ var barCodeList = barCode.Split(';');
+ if (!barCode.Contains("S104") || !barCode.Contains(".") || barCodeList[0].Length != 17 || barCodeList[1].Length != 4 || barCodeList[2].Length != 4)
+ {
+ model.Result = "0";
+ model.ErrReason = "总成条码格式不对或不存在";
+ Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ return;
+ }
+
+ //箱码和总成码零件验证
+ string boxPartNo = boxCodeList[0].Substring(3,10);
+ string barCodePartNo = barCodeList[0].Substring(0, 10);
+ if(boxPartNo != barCodePartNo)
+ {
+ model.Result = "0";
+ model.ErrReason = "箱码和总成条码零件号不符";
+ Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ return;
+ }
+
+
+
+ #endregion
+
+ int updateNum = Function.BindBoxCodeAndBarCode(boxCode, barCode, out errorReason);
+
+ dt = Function.GetCodeRecords(boxCode, out errorReasonBoxData);
+
+ if (dt.Rows.Count < 1)
+ {
+
+ model.ResultRowsCount = "0";
+ model.DataList = null;
+ if (string.IsNullOrEmpty(errorReasonBoxData))
+ {
+ model.Result = "1";
+ model.ErrReason = "";
+ }
+ else
+ {
+ model.Result = "0";
+ model.ErrReason = errorReasonBoxData;
+ }
+ }
+ else
+ {
+
+ listInfo = Tools.DataTableToList.ConvertTo(dt);
+ model.ResultRowsCount = listInfo.Count.ToString();
+ model.DataList = listInfo;
+ }
+
+ if (!string.IsNullOrEmpty(errorReason) && !string.IsNullOrEmpty(barCode))
+ {
+ model.Result = "0";
+ model.ErrReason = errorReason;
+ }
+ else
+ {
+ model.Result = "1";
+ string qtyValue = "0";
+ var boxCodeSplit = boxCode.Split(';');
+ foreach (string part in boxCodeSplit)
+ {
+ if (part.StartsWith("QTY:"))
+ {
+ qtyValue = part.Substring(4); // 从"QTY:"后的字符开始截取
+ }
+ }
+ if (listInfo.Count.ToString() == qtyValue)
+ {
+
+ }
+ }
+ }
+ Context.Response.Write(JSONTools.ScriptSerialize>(model));
+ }
+
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void MD5Encrypt(string str)
diff --git a/WebService/Function.cs b/WebService/Function.cs
index 4a330d3..2f759b5 100644
--- a/WebService/Function.cs
+++ b/WebService/Function.cs
@@ -325,6 +325,126 @@ namespace Webservice
}
}
+ ///
+ /// 获取装箱记录
+ ///
+ ///
+ ///
+ ///
+ public static DataTable GetCodeRecords(string boxCode, out string errorReason)
+ {
+ DataTable res = new DataTable();
+ try
+ {
+ string sql = @"
+ select * from tb_Punch_Code_Record where BoxCode = '" + boxCode + @"' order by CreateTime desc
+ ";
+ res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
+
+ errorReason = "";
+ return res;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLogManager(ex);
+ LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
+ errorReason = ex.Message;
+ return res;
+ }
+ }
+
+ ///
+ /// 箱码和总成码绑定
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static int BindBoxCodeAndBarCode(string boxCode, string barCode, out string errorReason)
+ {
+ int updateNum = 0;
+ string qtyValue = "0";
+ try
+ {
+ errorReason = "";
+ var boxCodeSplit = boxCode.Split(';');
+ foreach (string part in boxCodeSplit)
+ {
+ if (part.StartsWith("QTY:"))
+ {
+ qtyValue = part.Substring(4); // 从"QTY:"后的字符开始截取
+ }
+ }
+
+ DataTable dtBoxNum = GetCodeRecords(boxCode, out errorReason);
+ if(dtBoxNum != null && dtBoxNum.Rows.Count.ToString() == qtyValue)
+ {
+ errorReason = "扫描总数超出箱码限制数量";
+ return updateNum;
+ }
+
+
+
+ string sql = @"
+ select top 1 * from tb_Punch_Code_Record where Flag=1 and ZcBarCode = '" + barCode + @"' order by CreateTime desc
+ ";
+ DataTable dt = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
+ if (dt != null && dt.Rows.Count > 0)
+ {
+ string id = dt.Rows[0]["ID"].ToString();
+ string barcode = dt.Rows[0]["barcode"].ToString();
+ string zcBarCode = dt.Rows[0]["ZcBarCode"].ToString();
+ string boxCodeDB = dt.Rows[0]["BoxCode"].ToString();
+ if(string.IsNullOrEmpty(boxCodeDB))
+ {
+ string updateSql = @" update [dbo].[tb_Punch_Code_Record] set BoxCode='" + boxCode + "',pkg='"+qtyValue+"' where ID='" + id + "'";
+ updateNum = SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnString, CommandType.Text, updateSql, null);
+ if (updateNum == 0)
+ {
+ errorReason = "总成条码装箱失败";
+ }
+ else
+ {
+ string insertSql = @"
+ insert into tb_Punch_Interface(PackageCode,OneBarCode)
+ values('" + boxCode + "','"+ barCode + @"')
+ ";
+ int insertNum = SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnString, CommandType.Text, insertSql, null);
+ }
+ }
+ else
+ {
+ if(boxCode.Trim() == boxCodeDB.Trim())
+ {
+ errorReason = "总成条码已装箱";
+ }
+ else
+ {
+ errorReason = "总成条码已被其他箱码装箱";
+ }
+
+ }
+
+ }
+ else
+ {
+ errorReason = "总成条码格式不对或不存在";
+ }
+
+ return updateNum;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLogManager(ex);
+ LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
+ errorReason = ex.Message;
+ return updateNum;
+ }
+ }
+
+
+
+
public static DataTable GetMaterialInfo(string drumCode, out string errorReason)
{
DataTable res = new DataTable();
diff --git a/WebService/Model/MKModel .cs b/WebService/Model/MKModel .cs
new file mode 100644
index 0000000..7b5b120
--- /dev/null
+++ b/WebService/Model/MKModel .cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebService.Model
+{
+ public class MKModel
+ {
+ ///
+ /// 塑件码
+ ///
+ public string barcode { get; set; }
+ ///
+ /// 总成零件号
+ ///
+ public string ZcBarCode { get; set; }
+ /////
+ ///// 订单号
+ /////
+ //public string OrderNo { get; set; }
+ /////
+ ///// 班次
+ /////
+ //public string WorkClass { get; set; }
+ ///
+ /// 合格标记
+ ///
+ public int Flag { get; set; }
+ ///
+ /// 箱码
+ ///
+ public string BoxCode { get; set; }
+ /////
+ ///// 标包
+ /////
+ //public string PKG { get; set; }
+ /////
+ ///// 创建时间
+ /////
+ //public DateTime CreateTime { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/WebService/WebService.csproj b/WebService/WebService.csproj
index b40b104..4bc0235 100644
--- a/WebService/WebService.csproj
+++ b/WebService/WebService.csproj
@@ -122,6 +122,7 @@
+
diff --git a/WebService/WebService.csproj.user b/WebService/WebService.csproj.user
index e32f45c..1f24385 100644
--- a/WebService/WebService.csproj.user
+++ b/WebService/WebService.csproj.user
@@ -1,4 +1,4 @@
-
+
Debug|Any CPU
@@ -15,7 +15,7 @@
- WMSWebService.asmx
+ AppWebservice.asmx
SpecificPage
True
False
|