|
|
@ -817,93 +817,174 @@ namespace QMAPP.WinForm.Forms.Operation |
|
|
|
} |
|
|
|
if (ispass)//扫描的是过程主码
|
|
|
|
{ |
|
|
|
if (!string.IsNullOrEmpty(result.WorkOrderID)) |
|
|
|
//ZHANGSN 20220925 佛山276PA没有计划ID,使用物料号查找配置
|
|
|
|
if (_operationServiceParam.machineInfo.WORKLOC_CODE.Contains("276")) |
|
|
|
{ |
|
|
|
List<FJC.Entity.ProductionPlan.WorkOrder> list = this.dgvPlan.DataSource as List<FJC.Entity.ProductionPlan.WorkOrder>; |
|
|
|
|
|
|
|
var pBomcode = GetWorkOrder_MATERIAL_CODE(result.WorkOrderID); |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(pBomcode)) |
|
|
|
if (!string.IsNullOrEmpty(result.MATERIAL_CODE)) |
|
|
|
{ |
|
|
|
//List<FJC.Entity.ProductionPlan.WorkOrder> filterList = list.Where(p => pBomCodes.Contains(p.MATERIAL_CODE)).ToList();
|
|
|
|
|
|
|
|
var ScanIPConfig_list = GetSendPlcConfig(new ScanIPConfig() { MaterialCode = pBomcode, LocCode = _operationServiceParam.machineInfo.WORKLOC_CODE }); |
|
|
|
if (ScanIPConfig_list != null && ScanIPConfig_list.Count > 0) |
|
|
|
var bomCodes = GetPBOMCODEValue(result.MATERIAL_CODE); |
|
|
|
foreach (var bom in bomCodes) |
|
|
|
{ |
|
|
|
foreach (var Config in ScanIPConfig_list) |
|
|
|
|
|
|
|
var ScanIPConfig_list = GetSendPlcConfig(new ScanIPConfig() { MaterialCode = bom, LocCode = _operationServiceParam.machineInfo.WORKLOC_CODE }); |
|
|
|
if (ScanIPConfig_list != null && ScanIPConfig_list.Count > 0) |
|
|
|
{ |
|
|
|
if (!string.IsNullOrEmpty(Config.PlcAddr)) |
|
|
|
foreach (var Config in ScanIPConfig_list) |
|
|
|
{ |
|
|
|
var BarCode = Config.BarCode; |
|
|
|
var PlcAddr = Config.PlcAddr; |
|
|
|
GetNewCode(ref BarCode, ref PlcAddr); //查询产品条码是否存在
|
|
|
|
if (UpdateSendPlcConfig(new ScanIPConfig { PID = Config.PID, PlcAddr = PlcAddr })) |
|
|
|
if (!string.IsNullOrEmpty(Config.PlcAddr)) |
|
|
|
{ |
|
|
|
var ProductList = SelectProduct(Config.BarCode); |
|
|
|
if (ProductList != null) |
|
|
|
var BarCode = Config.BarCode; |
|
|
|
var PlcAddr = Config.PlcAddr; |
|
|
|
GetNewCode(ref BarCode, ref PlcAddr); //查询产品条码是否存在
|
|
|
|
if (UpdateSendPlcConfig(new ScanIPConfig { PID = Config.PID, PlcAddr = PlcAddr })) |
|
|
|
{ |
|
|
|
var PID = Guid.NewGuid().ToString(); |
|
|
|
var ProductNew = new Product() |
|
|
|
{ |
|
|
|
PRODUCTCODE = BarCode, |
|
|
|
PID = PID, |
|
|
|
MACHINECODDE = _operationServiceParam.machineInfo.MACHINECODDE, |
|
|
|
MACHINENAME = _operationServiceParam.machineInfo.MACHINENAME, |
|
|
|
PRODUCTSOURCE = "0", |
|
|
|
MATERIAL_CODE = ProductList.MATERIAL_CODE, |
|
|
|
STATUS = "0", |
|
|
|
OUTFLAG = "0", |
|
|
|
USINGSTATE = "0", |
|
|
|
CAPACITY = 1, |
|
|
|
USINGCOUNT = 0, |
|
|
|
WORKCELL_CODE = ProductList.WORKCELL_CODE, |
|
|
|
WORKLOC_CODE = ProductList.WORKLOC_CODE, |
|
|
|
WORKCENTER_CODE = ProductList.WORKCENTER_CODE |
|
|
|
}; |
|
|
|
|
|
|
|
var ProcessRecords = new ProcessRecord() |
|
|
|
var ProductList = SelectProduct(Config.BarCode); |
|
|
|
if (ProductList != null) |
|
|
|
{ |
|
|
|
PID = Guid.NewGuid().ToString(), |
|
|
|
PRODUCT_PID = ProductNew.PID, |
|
|
|
WORKCELL_CODE = ProductList.WORKCELL_CODE, |
|
|
|
WORKLOC_CODE = ProductList.WORKLOC_CODE, |
|
|
|
IN_WORKCELL_TIME = DateTime.Now, |
|
|
|
WORK_START_TIME = DateTime.Now, |
|
|
|
WORK_END_TIME = DateTime.Now, |
|
|
|
PROCESS_STATE = "1", |
|
|
|
MANUAL_PASS = "", |
|
|
|
MODULE_CODE = string.Equals(dai.DIVBY_MOULD, "0") ? _operationServiceParam.machineInfo.WORKCELL_CODE : (string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text) |
|
|
|
}; |
|
|
|
if (InsertProduct(ProductNew) && InsertProcessRecord(ProcessRecords)) |
|
|
|
{ |
|
|
|
txtCode.Text = BarCode; |
|
|
|
Operation(); |
|
|
|
var PID = Guid.NewGuid().ToString(); |
|
|
|
var ProductNew = new Product() |
|
|
|
{ |
|
|
|
PRODUCTCODE = BarCode, |
|
|
|
PID = PID, |
|
|
|
MACHINECODDE = _operationServiceParam.machineInfo.MACHINECODDE, |
|
|
|
MACHINENAME = _operationServiceParam.machineInfo.MACHINENAME, |
|
|
|
PRODUCTSOURCE = "0", |
|
|
|
MATERIAL_CODE = ProductList.MATERIAL_CODE, |
|
|
|
STATUS = "0", |
|
|
|
OUTFLAG = "0", |
|
|
|
USINGSTATE = "0", |
|
|
|
CAPACITY = 1, |
|
|
|
USINGCOUNT = 0, |
|
|
|
WORKCELL_CODE = ProductList.WORKCELL_CODE, |
|
|
|
WORKLOC_CODE = ProductList.WORKLOC_CODE, |
|
|
|
WORKCENTER_CODE = ProductList.WORKCENTER_CODE |
|
|
|
}; |
|
|
|
|
|
|
|
//var ProcessRecords = new ProcessRecord()
|
|
|
|
//{
|
|
|
|
// PID = Guid.NewGuid().ToString(),
|
|
|
|
// PRODUCT_PID = ProductNew.PID,
|
|
|
|
// WORKCELL_CODE = ProductList.WORKCELL_CODE,
|
|
|
|
// WORKLOC_CODE = ProductList.WORKLOC_CODE,
|
|
|
|
// IN_WORKCELL_TIME = DateTime.Now,
|
|
|
|
// WORK_START_TIME = DateTime.Now,
|
|
|
|
// WORK_END_TIME = DateTime.Now,
|
|
|
|
// PROCESS_STATE = "1",
|
|
|
|
// MANUAL_PASS = "",
|
|
|
|
// MODULE_CODE = string.Equals(dai.DIVBY_MOULD, "0") ? _operationServiceParam.machineInfo.WORKCELL_CODE : (string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text)
|
|
|
|
//};
|
|
|
|
//if (InsertProduct(ProductNew) && InsertProcessRecord(ProcessRecords))
|
|
|
|
if (InsertProduct(ProductNew)) |
|
|
|
{ |
|
|
|
txtCode.Text = BarCode; |
|
|
|
Operation(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
txtCode.Text = Config.BarCode; |
|
|
|
Operation(); |
|
|
|
else |
|
|
|
{ |
|
|
|
txtCode.Text = Config.BarCode; |
|
|
|
Operation(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// this.lblError.Text = "通过result.WorkOrderID({result.WorkOrderID.ToString()})未查询到WorkOrder.PBOM_CODE";
|
|
|
|
// this.lblError.ForeColor = Color.Black;
|
|
|
|
// MessageBox.Show($"通过result.WorkOrderID({result.WorkOrderID.ToString()})未查询到WorkOrder.PBOM_CODE");
|
|
|
|
//}
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
this.lblError.Text = "result.WorkOrderID为空,未进行后续填充!"; |
|
|
|
this.lblError.ForeColor = Color.Black; |
|
|
|
MessageBox.Show($"result.WorkOrderID为空,未进行后续填充!"); |
|
|
|
if (!string.IsNullOrEmpty(result.WorkOrderID)) |
|
|
|
{ |
|
|
|
List<FJC.Entity.ProductionPlan.WorkOrder> list = this.dgvPlan.DataSource as List<FJC.Entity.ProductionPlan.WorkOrder>; |
|
|
|
|
|
|
|
var pBomcode = GetWorkOrder_MATERIAL_CODE(result.WorkOrderID); |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(pBomcode)) |
|
|
|
{ |
|
|
|
//List<FJC.Entity.ProductionPlan.WorkOrder> filterList = list.Where(p => pBomCodes.Contains(p.MATERIAL_CODE)).ToList();
|
|
|
|
|
|
|
|
var ScanIPConfig_list = GetSendPlcConfig(new ScanIPConfig() { MaterialCode = pBomcode, LocCode = _operationServiceParam.machineInfo.WORKLOC_CODE }); |
|
|
|
if (ScanIPConfig_list != null && ScanIPConfig_list.Count > 0) |
|
|
|
{ |
|
|
|
foreach (var Config in ScanIPConfig_list) |
|
|
|
{ |
|
|
|
if (!string.IsNullOrEmpty(Config.PlcAddr)) |
|
|
|
{ |
|
|
|
var BarCode = Config.BarCode; |
|
|
|
var PlcAddr = Config.PlcAddr; |
|
|
|
GetNewCode(ref BarCode, ref PlcAddr); //查询产品条码是否存在
|
|
|
|
if (UpdateSendPlcConfig(new ScanIPConfig { PID = Config.PID, PlcAddr = PlcAddr })) |
|
|
|
{ |
|
|
|
var ProductList = SelectProduct(Config.BarCode); |
|
|
|
if (ProductList != null) |
|
|
|
{ |
|
|
|
var PID = Guid.NewGuid().ToString(); |
|
|
|
var ProductNew = new Product() |
|
|
|
{ |
|
|
|
PRODUCTCODE = BarCode, |
|
|
|
PID = PID, |
|
|
|
MACHINECODDE = _operationServiceParam.machineInfo.MACHINECODDE, |
|
|
|
MACHINENAME = _operationServiceParam.machineInfo.MACHINENAME, |
|
|
|
PRODUCTSOURCE = "0", |
|
|
|
MATERIAL_CODE = ProductList.MATERIAL_CODE, |
|
|
|
STATUS = "0", |
|
|
|
OUTFLAG = "0", |
|
|
|
USINGSTATE = "0", |
|
|
|
CAPACITY = 1, |
|
|
|
USINGCOUNT = 0, |
|
|
|
WORKCELL_CODE = ProductList.WORKCELL_CODE, |
|
|
|
WORKLOC_CODE = ProductList.WORKLOC_CODE, |
|
|
|
WORKCENTER_CODE = ProductList.WORKCENTER_CODE |
|
|
|
}; |
|
|
|
|
|
|
|
var ProcessRecords = new ProcessRecord() |
|
|
|
{ |
|
|
|
PID = Guid.NewGuid().ToString(), |
|
|
|
PRODUCT_PID = ProductNew.PID, |
|
|
|
WORKCELL_CODE = ProductList.WORKCELL_CODE, |
|
|
|
WORKLOC_CODE = ProductList.WORKLOC_CODE, |
|
|
|
IN_WORKCELL_TIME = DateTime.Now, |
|
|
|
WORK_START_TIME = DateTime.Now, |
|
|
|
WORK_END_TIME = DateTime.Now, |
|
|
|
PROCESS_STATE = "1", |
|
|
|
MANUAL_PASS = "", |
|
|
|
MODULE_CODE = string.Equals(dai.DIVBY_MOULD, "0") ? _operationServiceParam.machineInfo.WORKCELL_CODE : (string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text) |
|
|
|
}; |
|
|
|
if (InsertProduct(ProductNew) && InsertProcessRecord(ProcessRecords)) |
|
|
|
{ |
|
|
|
txtCode.Text = BarCode; |
|
|
|
Operation(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
txtCode.Text = Config.BarCode; |
|
|
|
Operation(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// this.lblError.Text = "通过result.WorkOrderID({result.WorkOrderID.ToString()})未查询到WorkOrder.PBOM_CODE";
|
|
|
|
// this.lblError.ForeColor = Color.Black;
|
|
|
|
// MessageBox.Show($"通过result.WorkOrderID({result.WorkOrderID.ToString()})未查询到WorkOrder.PBOM_CODE");
|
|
|
|
//}
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
this.lblError.Text = "result.WorkOrderID为空,未进行后续填充!"; |
|
|
|
this.lblError.ForeColor = Color.Black; |
|
|
|
MessageBox.Show($"result.WorkOrderID为空,未进行后续填充!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|