private void txtUseNPallet_Leave(object sender, EventArgs e) { if (this.txtUseNPallet.Value.Trim().Length != 0) { PackageFacade objFacade = new PackageFacade(this.DataProvider); object pallet = objFacade.GetPallet(this.txtUseNPallet.Value); if (pallet != null) { //该栈板已存在 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_PALLETNO_IS_EXIT")); txtUseNPallet.TextFocus(true, true); } InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider); object[] stackToRcardS = inventoryFacade.GetRcardToStackPallet(this.ucLabelEditStock.Value.Trim(), this.txtUseNPallet.Value, ""); if (stackToRcardS != null) { //该栈板已经在目标垛位中 垛位= ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_PALLETNO_IN_TRA_STACK=" + ((RcardToStackPallet)stackToRcardS[0]).StackCode)); txtUseNPallet.TextFocus(true, true); } } }
public void SetData(string palletCode, bool autoPrint) { this.m_AutoPrint = autoPrint; this.InitTable(); PackageFacade packageFacade = new PackageFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); //Get head data DBDateTime dbDateTime; dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); string printDate = FormatHelper.ToDateString(dbDateTime.DBDate, "/"); Pallet pallet = (Pallet)packageFacade.GetPallet(palletCode); if (pallet == null) { return; } //string moCode = pallet.MOCode; string ssCode = pallet.SSCode; string itemCode = pallet.ItemCode; string itemDesc = ""; string itemMachineType = ""; string itemModelGroup = ""; Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(itemCode, pallet.OrganizationID); if (material != null) { itemDesc = material.MaterialDescription == null ? "" : material.MaterialDescription; itemMachineType = material.MaterialMachineType == null ? "" : material.MaterialMachineType; itemModelGroup = material.MaterialModelGroup == null ? "" : material.MaterialModelGroup; } //Get grid data object[] palletDetail = packageFacade.GetPalletDetailInfo(palletCode); int seq = 0; if (palletDetail != null) { foreach (SimulationReport detail in palletDetail) { seq++; DataRow row = tblData.NewRow(); row["Seq"] = seq; row["LotNo"] = detail.LOTNO; row["RCard"] = detail.RunningCard; row["CartonCode"] = detail.CartonCode; row["MOCode"] = detail.MOCode; tblData.Rows.Add(row); } } string appPath = Application.StartupPath + "\\PackPalletPrint.rdlc"; this.ReportViewerPallet.LocalReport.DataSources.Clear(); this.ReportViewerPallet.Reset(); this.ReportViewerPallet.LocalReport.ReportPath = appPath; this.ReportViewerPallet.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSetPalletPrint_PalletDetail", tblData)); ReportParameter param1 = new ReportParameter("PalletCode", new string[] { palletCode }); ReportParameter param2 = new ReportParameter("PrintDate", new string[] { printDate }); ReportParameter param3 = new ReportParameter("ItemCode", new string[] { itemCode }); ReportParameter param4 = new ReportParameter("ItemDesc", new string[] { itemDesc }); //ReportParameter param5 = new ReportParameter("MOCode", new string[] { moCode }); ReportParameter param6 = new ReportParameter("SSCode", new string[] { ssCode }); ReportParameter param7 = new ReportParameter("MachineCode", new string[] { itemMachineType }); ReportParameter param8 = new ReportParameter("ScreenCode", new string[] { itemModelGroup }); this.ReportViewerPallet.LocalReport.SetParameters(new ReportParameter[] { param1, param2, param3, param4, param6, param7, param8 }); this.ReportViewerPallet.LocalReport.Refresh(); }
private bool InputPallet(string palletCode) { ////Check 栈板是否存在 // PackageFacade objFacade = new PackageFacade(this.DataProvider); object pallet = objFacade.GetPallet(palletCode); if (pallet == null) { //Message:该栈板不存在 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_PALLETNO_IS_NOT_EXIT")); return(false); } InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider); ////使用原栈板 // if (this.rdoUseOPallet.Checked) { ////Check 栈板在目标垛位中已经存在 // object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet(this.ucLabelEditStock.Value, palletCode, ""); if (rcardToStackPallet != null) { //Message:栈板在目标垛位中已经存在 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_EXIST_IN_TAR_STACK")); return(false); } ////获取源栈板的垛位资料 // object[] rcardToStackPalletList = inventoryFacade.GetRcardToStackPallet("", palletCode, ""); if (rcardToStackPalletList == null) { //Message:源栈板对应的垛位信息不存在 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_NOT_EXIST_IN_ORI_STACK")); return(false); } if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) && CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(), ((RcardToStackPallet)rcardToStackPalletList[0]).ItemCode)) { //Message:目标垛位的物料和当前物料不一致 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF")); return(false); } ////根据源栈板的Rcard更新StackToRcard // inventoryFacade.UpdatePalletStackByWholePallet(rcardToStackPalletList, this.ucLabelComboxINVType.SelectedItemValue.ToString(), this.ucLabelEditStock.Value.Trim(), ApplicationService.Current().LoginInfo.UserCode); //Load Grid this.LoadGrid(rcardToStackPalletList, this.ucLabelEditStock.Value.Trim(), palletCode); } ////使用目标垛位栈板 // if (this.rdoUseTPallet.Checked) { if (palletCode.Equals(this.txtUseTPallet.Value.Trim())) { //Message:源栈板和目标栈板相同 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_PALLETNO_SAME_AS_TARPALLET")); return(false); } ////check目标垛位栈板的,产品,公司别,产品档次,是否和序列号的栈板一致 // //获取源栈板信息 object[] objOriStackToRcardList = inventoryFacade.GetStackToRcardInfoByPallet(palletCode); object[] objTarStackToRcardList = inventoryFacade.GetStackToRcardInfoByPallet(this.txtUseTPallet.Value.Trim()); if (objOriStackToRcardList == null) { //Message:源栈板对应的垛位信息不存在 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_NOT_EXIST_IN_ORI_STACK")); return(false); } if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) && CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(), ((StackToRcard)objOriStackToRcardList[0]).ItemCode)) { //Message:目标垛位的物料和当前物料不一致 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF")); return(false); } string strErrorMessage = string.Empty; StackToRcard objOri = (StackToRcard)objOriStackToRcardList[0]; StackToRcard objTar = (StackToRcard)objTarStackToRcardList[0]; if (objOri.ItemCode != objTar.ItemCode) { strErrorMessage = strErrorMessage + "itemcode"; ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_ITEM_NOT_SAME_IN_PALLET_TWO $CS_TARGET=" + objTar.ItemCode + " $CS_ORIGINAL=" + objOri.ItemCode)); } if (objOri.Company != objTar.Company) { strErrorMessage = strErrorMessage + "companycode"; ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_COMPANY_NOT_SAME_IN_PALLET_TWO $CS_TARGET=" + objTar.Company + " $CS_ORIGINAL=" + objOri.Company)); } if (strErrorMessage != string.Empty) { return(false); } ////获取源栈板的垛位资料 // object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet("", palletCode, ""); ////把原栈板更新为目标栈板 // inventoryFacade.UpdateOriPalletStackToTargetPallet(rcardToStackPallet, this.txtUseTPallet.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(), this.ucLabelEditStock.Value.Trim(), ApplicationService.Current().LoginInfo.UserCode); //Load Grid this.LoadGrid(rcardToStackPallet, this.ucLabelEditStock.Value.Trim(), this.txtUseTPallet.Value.Trim()); } ////使用新栈板 // if (this.rdoUseNPallet.Checked) { if (palletCode.Equals(this.txtUseNPallet.Value.Trim())) { //Message:源栈板和目标栈板相同 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_PALLETNO_SAME_AS_TARPALLET")); return(false); } ////获取源栈板的垛位资料 // object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet("", palletCode, ""); if (rcardToStackPallet == null) { //Message:源栈板对应的垛位信息不存在 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_NOT_EXIST_IN_ORI_STACK")); return(false); } if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) && CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(), ((RcardToStackPallet)rcardToStackPallet[0]).ItemCode)) { //Message:目标垛位的物料和当前物料不一致 ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF")); return(false); } //检查栈板容量是否满 if (!inventoryFacade.CheckStackCapacity(this.ucLabelComboxINVType.SelectedItemValue.ToString().Trim().ToUpper(), this.ucLabelEditStock.Value.Trim().ToUpper())) { ApplicationRun.GetInfoForm().Add( new UserControl.Message(MessageType.Error, "$CS_STACK_CAPACITY_FULL")); return(false); } string lotNo = " "; DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); SimulationReport simulationReport = (SimulationReport)dataCollectFacade.GetRcardFromSimulationReport(((RcardToStackPallet)rcardToStackPallet[0]).SerialNo); if (simulationReport != null) { OQCFacade oqcFacade = new OQCFacade(this.DataProvider); OQCLot2Card oqcLot2Card = (OQCLot2Card)oqcFacade.GetLastOQCLot2CardByRCard(simulationReport.RunningCard); if (oqcLot2Card != null) { lotNo = oqcLot2Card.LOTNO; } } //把原栈板更新为新栈板 inventoryFacade.UpdateOriPalletStackToNewPallet(rcardToStackPallet, this.txtUseNPallet.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(), this.ucLabelEditStock.Value.Trim(), ApplicationService.Current().LoginInfo.UserCode, ApplicationService.Current().ResourceCode, lotNo); //Load Grid this.LoadGrid(rcardToStackPallet, this.ucLabelEditStock.Value.Trim(), this.txtUseNPallet.Value.Trim()); } return(true); }