| | |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"产品{pro.PID}数据上传MES失败 {tems}"); |
| | | result = "obj.zerrmsg"; |
| | | result = string.Empty; |
| | | if (obj.zerrmsg.Contains("重复数据")) |
| | | { |
| | | return true; |
| | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 产品零盘上传启动标识 |
| | | /// </summary> |
| | | private bool isStartclear =false; |
| | | |
| | | [ProcessMethod("", "MEStogetcode", "MES上传整批数据并获取条码", InvokeType.TestInvoke)] |
| | | public ResponseMessage MEStogetcode(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品信息上传mes触发,获取PLC序号{plcnum[0]}和{plcnum1[0]}"); |
| | | |
| | | string saveTary_ID=string.Empty; |
| | | |
| | | //if (!Issuccess && !Issuccess1) |
| | | //{ |
| | | // Plc3.WriteSingleAddress(2120, 2, out _); |
| | | // return msg; |
| | | //} |
| | | |
| | | string saveTary_ID= string.Empty; |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品信息上传MES触发,产品信息数量为:{M141Config.Productioncode.Count}"); |
| | | |
| | | if (M141Config.Productioncode.Count == 50) |
| | |
| | | newp.Result = "OK"; |
| | | newp.SN = M141Config.Productioncode[0].SN; |
| | | string tary_ID = string.Empty; |
| | | bool isok = UptoMES(newp, "N", out tary_ID); |
| | | bool isok = true; |
| | | if (M141Config.Productioncode.Count==1) |
| | | { |
| | | if (isStartclear) |
| | | { |
| | | |
| | | isok = UptoMES(newp, "Y", out tary_ID); |
| | | isStartclear = false; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}启动零盘尾数上传"); |
| | | } |
| | | else |
| | | { |
| | | isok = UptoMES(newp, "N", out tary_ID); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | isok = UptoMES(newp, "N", out tary_ID); |
| | | } |
| | | |
| | | if (!isok) |
| | | { |
| | | Plc3.WriteSingleAddress(2120, 2, out _); |
| | |
| | | } |
| | | if (M141Config.Isprint && !string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | saveTary_ID = tary_ID; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Add(new MES_code |
| | | if (M141Config.Productioncode.Count == 1) |
| | | { |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | saveTary_ID = tary_ID; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Add(new MES_code |
| | | { |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"条码:{tary_ID}不是在最后一件产品获取,启动零盘清除复位产品上传动作"); |
| | | isStartclear = true; |
| | | } |
| | | |
| | | } |
| | | M141Config.Productioncode.RemoveAt(0); |
| | | } |
| | |
| | | } |
| | | else if (M141Config.Productioncode.Count > 50) |
| | | { |
| | | //中途有产品被取走 |
| | | //中途有产品被取走导致条码大于实际数量 |
| | | for (int i = 0; i < 50; i++) |
| | | { |
| | | ProductModel newp = new ProductModel(); |
| | |
| | | newp.Result = "OK"; |
| | | newp.SN = M141Config.Productioncode[count - 1].SN; |
| | | string tary_ID = string.Empty; |
| | | bool isok = UptoMES(newp, "N", out tary_ID); |
| | | bool isok = true; |
| | | if (i==49) |
| | | { |
| | | if (isStartclear) |
| | | { |
| | | isok = UptoMES(newp, "Y", out tary_ID); |
| | | isStartclear = false; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}启动零盘尾数上传"); |
| | | } |
| | | else |
| | | { |
| | | isok = UptoMES(newp, "N", out tary_ID); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | isok = UptoMES(newp, "N", out tary_ID); |
| | | } |
| | | if (!isok) |
| | | { |
| | | Plc3.WriteSingleAddress(2120, 2, out _); |
| | |
| | | } |
| | | if (M141Config.Isprint && !string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | saveTary_ID = tary_ID; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Add(new MES_code |
| | | if (i == 49) |
| | | { |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | saveTary_ID = tary_ID; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Add(new MES_code |
| | | { |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"条码:{tary_ID}不是在最后一件产品获取,启动零盘清除复位产品上传动作"); |
| | | isStartclear = true; |
| | | } |
| | | |
| | | } |
| | | M141Config.Productioncode.RemoveAt(count - 1); |
| | | } |
| | |
| | | } |
| | | else if (M141Config.Productioncode.Count > 0 && M141Config.Productioncode.Count < 50) |
| | | { |
| | | //产品缺少需要额外的条码补救 |
| | | //产品缺少需要清除零盘 |
| | | while (M141Config.Productioncode.Count > 0) |
| | | { |
| | | ProductModel newp = new ProductModel(); |
| | |
| | | if (M141Config.Productioncode.Count==1) |
| | | { |
| | | isok = UptoMES(newp, "Y", out tary_ID); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}触发零数尾盘"); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}启动零盘尾数上传"); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | if (M141Config.Isprint && !string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | saveTary_ID = tary_ID; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Add(new MES_code |
| | | if (M141Config.Productioncode.Count == 1) |
| | | { |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | saveTary_ID = tary_ID; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Add(new MES_code |
| | | { |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"条码:{tary_ID}不是在最后一件产品获取,启动零盘清除复位产品上传动作"); |
| | | isStartclear = true; |
| | | } |
| | | } |
| | | M141Config.Productioncode.RemoveAt(0); |
| | | } |
| | |
| | | StartPrint(saveTary_ID, "Honeywell PX240S (300 dpi)"); |
| | | } |
| | | } |
| | | //if (Issuccess && Issuccess1) |
| | | //{ |
| | | Plc3.WriteSingleAddress(2120, 1, out _); |
| | | return msg; |
| | | //} |
| | | //else |
| | | //{ |
| | | // Plc3.WriteSingleAddress(2120, 2, out _); |
| | | // return msg; |
| | | //} |
| | | |
| | | return msg; |
| | | } |
| | | |
| | | [ProcessMethod("", "MESup1", "MES上传进料口空篮", InvokeType.TestInvoke)] |