private bool CartonPack() { if (this.ucLabelCartonNoForLot.Value.Trim() == "") { this.m_FlowControl = 2; this.SetInputMessageByFlowControl(); return(false); } string cartonNo = FormatHelper.CleanString(this.ucLabelCartonNoForLot.Value.Trim().ToUpper()); if (this.ucLabelLotCode.Value.Trim() == "") { m_FlowControl = 1; this.SetInputMessageByFlowControl(); return(false); } //ucMessage.AddWithoutEnter("<<"); //ucMessage.AddBoldText(ucLabelCartonNoForLot.Value.Trim()); if (!CheckCarton(cartonNo)) { this.m_FlowControl = 4; this.SetInputMessageByFlowControl(); return(false); } string lotCode = FormatHelper.CleanString(ucLabelLotCode.Value.Trim().ToUpper()); LotSimulationReport objSimulation = (m_DataCollectFacade.QueryLotSimulationReport(lotCode))[0] as LotSimulationReport; Item item = m_ItemFacade.GetItem(objSimulation.ItemCode.ToUpper().Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item; string newMOCode = objSimulation.MOCode.Trim().ToUpper(); //判断序列号是否已经装过箱,应该装在之前的箱中 //OQCFacade _OQCFacade = new OQCFacade(this.DataProvider); //object lot2Card = _OQCFacade.GetOQCLot2Card(sourceCard.Trim().ToUpper(), newMOCode, "", ""); //if(lot2Card != null) //{ // if ((!String.IsNullOrEmpty(((OQCLot2Card)lot2Card).EAttribute1)) && cartonNo != ((OQCLot2Card)lot2Card).EAttribute1.ToString()) // { // ucMessage.AddEx(this._FunctionName, " ", new UserControl.Message(MessageType.Error, "$RCard:" + sourceCard + "$ShouedPackInCarton:" + ((OQCLot2Card)lot2Card).EAttribute1.ToString()), false); // this.m_FlowControl = 3; // this.SetInputMessageByFlowControl(); // return false; // } //} #region check批次 if (!CheckLot(lotCode)) { this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } //check一个箱子只能放一个类型的产品,并且只能放一个工单的产品 object[] objects = m_PackageFacade.GetCarton2LotByCartonNO(cartonNo); if (objects != null) { string oldMOCode = ((Carton2Lot)objects[0]).MOCode.Trim().ToUpper(); if (newMOCode != oldMOCode) { ShowMessage("$OneCarton_OneMoCode"); this.m_FlowControl = 4; this.SetInputMessageByFlowControl(); return(false); } object obj = m_PackageFacade.GetItemCodeByMOCode(oldMOCode); if (obj != null) { if (item.ItemCode != ((CartonCollection)obj).ItemCode) { ShowMessage("$OneCarton_OneProduct"); this.m_FlowControl = 4; this.SetInputMessageByFlowControl(); return(false); } } } #endregion this.AfterToSave(); return(true); }
private bool CartonPack() { if (this.ucLabelLotCodeForCarton.Value.Trim() == "") { this.SetInputMessageByFlowControl(); return(false); } string lotCode = FormatHelper.CleanString(this.ucLabelLotCodeForCarton.Value.Trim().ToUpper()); if (this.ucLabelCartonNo.Value.Trim() == "") { m_FlowControl = 1; this.SetInputMessageByFlowControl(); return(false); } #region LotCode Length Check //if (chkLotCodeLen.Checked && chkLotCodeLen.Value.Trim().Length > 0) //{ // if (lotCode.Length != Convert.ToInt32(chkLotCodeLen.Value.Replace("-", ""))) // { // ucMessage.AddEx(this.m_FunctionName, "批次条码: " + this.ucLabelLotCodeForCarton.Value, new UserControl.Message(MessageType.Error, "$CS_LOT_NO_LEN_CHECK_FAIL"), false); // this.m_FlowControl = 3; // this.SetInputMessageByFlowControl(); // return false; // } //} #endregion #region LotCode First Char Check //if (chkLotCodeFChar.Checked && chkLotCodeFChar.Value.Trim().Length > 0) //{ // if (lotCode.IndexOf(chkLotCodeFChar.Value.Trim()) != 0) // { // ucMessage.AddEx(this.m_FunctionName, "批次条码: " + this.ucLabelLotCodeForCarton.Value, new UserControl.Message(MessageType.Error, "$CS_LOT_NO_FCHAR_CHECK_FAIL"), false); // this.m_FlowControl = 3; // this.SetInputMessageByFlowControl(); // return false; // } //} #endregion //ucMessage.AddWithoutEnter("<<"); //ucMessage.AddBoldText(ucLabelLotCodeForCarton.Value.Trim()); if (!CheckLot(lotCode)) { this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } LotSimulationReport objSimulation = (m_DataCollectFacade.QueryLotSimulationReport(lotCode))[0] as LotSimulationReport; Item item = m_ItemFacade.GetItem(objSimulation.ItemCode.ToUpper().Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item; string newMOCode = objSimulation.MOCode.Trim().ToUpper(); string cartonNo = FormatHelper.CleanString(ucLabelCartonNo.Value.Trim().ToUpper()); //判断序列号是否已经装过箱,应该装在之前的箱中 //OQCFacade _OQCFacade = new OQCFacade(this.DataProvider); //object lot2Card = _OQCFacade.GetOQCLot2Card(sourceCard.Trim().ToUpper(), newMOCode, "", ""); //if(lot2Card != null) //{ // if ((!String.IsNullOrEmpty(((OQCLot2Card)lot2Card).EAttribute1)) && cartonNo != ((OQCLot2Card)lot2Card).EAttribute1.ToString()) // { // ucMessage.AddEx(this._FunctionName, " ", new UserControl.Message(MessageType.Error, "$RCard:" + sourceCard + "$ShouedPackInCarton:" + ((OQCLot2Card)lot2Card).EAttribute1.ToString()), false); // this.m_FlowControl = 3; // this.SetInputMessageByFlowControl(); // return false; // } //} #region check箱 if (!CheckCarton(cartonNo)) { return(false); } //check产品序列号是否重复包装 decimal cartonQty = m_PackageFacade.SumCartonQty(lotCode.Trim().ToUpper()); if (cartonQty >= objSimulation.LotQty) { ShowMessage("$CS_LOT_HAS_PACKED"); this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } //check一个箱子只能放一个类型的产品,并且只能放一个工单的产品 object[] objects = m_PackageFacade.GetCarton2LotByCartonNO(cartonNo); if (objects != null) { string oldMOCode = ((Carton2Lot)objects[0]).MOCode.Trim().ToUpper(); if (newMOCode != oldMOCode) { ShowMessage("$OneCarton_OneMoCode"); this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } object obj = m_PackageFacade.GetItemCodeByMOCode(oldMOCode); if (obj != null) { if (item.ItemCode != ((CartonCollection)obj).ItemCode) { ShowMessage("$OneCarton_OneProduct"); this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } } } #endregion // 包装动作 this.AfterToSave(); return(true); }