//确定 protected void cmdOK_ServerClick(object sender, System.EventArgs e) { ItemFacade itemFacade = new ItemFacade(this.DataProvider); string dQMCode = FormatHelper.CleanString(this.txtMaterialNO.Text); this.txtSpecialDescEdit.Text = ""; this.txtMaterialENDesc.Text = ""; this.txtMaterialCHDesc.Text = ""; this.txtUnitEdit.Text = ""; if (string.IsNullOrEmpty(dQMCode)) { WebInfoPublish.Publish(this, "物料编码为空", this.languageComponent1); this.txtMaterialNO.Focus(); return; } Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterialByDQMCode(dQMCode); if (material == null) { WebInfoPublish.Publish(this, "物料主数据没有该物料编码: " + dQMCode, this.languageComponent1); this.txtMaterialNO.Focus(); return; } this.txtMaterialENDesc.Text = material.MenshortDesc; this.txtMaterialCHDesc.Text = material.MchshortDesc; this.txtUnitEdit.Text = material.Muom; }
private object GetMaterialObject(Item item) { Domain.MOModel.Material material = this._itemFacade.CreateNewMaterial(); material.MaterialCode = ((Item)item).ItemCode; material.MaterialName = ((Item)item).ItemName; material.MaterialDescription = ((Item)item).ItemDescription; material.MaterialUOM = ((Item)item).ItemUOM; material.MaterialType = ((Item)item).ItemType; material.MaterialMachineType = " "; material.MaterialVolume = " "; material.MaterialModelCode = " "; material.MaterialExportImport = " "; material.MaterialModelGroup = " "; material.MaterialGroup = " "; material.MaterialGroupDescription = " "; material.MaterialControlType = " "; material.MaintainUser = this.GetUserCode(); //material.MaintainDate = ; //material.MaintainTime =; material.EAttribute1 = " "; material.OrganizationID = ((Item)item).OrganizationID; material.MaterialParseType = "parse_prepare"; material.CheckStatus = " "; material.MaterialCheckType = "check_linkbarcode"; material.SerialNoLength = 0; material.VendorCode = " "; material.ROHS = "N"; material.NeedVendor = "N"; material.MShelfLife = 0; return(material); }
protected override object GetEditObject() { if (_InventoryFacade == null) { _InventoryFacade = new InventoryFacade(base.DataProvider); } SpecInOut specInOut = this._InventoryFacade.CreateNewSpecinout(); ItemFacade itemFacade = new ItemFacade(this.DataProvider); string dQMCode = FormatHelper.CleanString(this.txtMaterialNO.Text); Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterialByDQMCode(dQMCode); if (material == null) { specInOut.MCode = FormatHelper.CleanString(this.txtMaterialNO.Text, 40); } else { specInOut.MCode = material.MCode; } specInOut.InOutDesc = txtSpecialDescEdit.Text; specInOut.DQMCode = FormatHelper.CleanString(this.txtMaterialNO.Text, 40); specInOut.Muom = FormatHelper.CleanString(this.txtUnitEdit.Text, 40); specInOut.MoveType = "O"; specInOut.StorageCode = FormatHelper.CleanString(this.drpStorageOutEdit.SelectedValue, 40); specInOut.LocationCode = FormatHelper.CleanString(this.drpLoationOutEdit.SelectedValue, 40); specInOut.Qty = Convert.ToInt32(FormatHelper.CleanString(this.txtQTY.Text, 40)); specInOut.MaintainUser = this.GetUserCode(); specInOut.InOutDesc = txtSpecialDescEdit.Text; return(specInOut); }
protected override void SetEditObject(object obj) { PickDetail pickDetail = obj as PickDetail; if (pickDetail == null) { this.txtDQMCodeEdit.Text = string.Empty; txtScarpDQMCodeEdit.Text = string.Empty; this.txtMDescEdit.Text = ""; this.txtQtyEdit.Text = ""; txtPickLineEdit.Text = ""; txtInvLineEidt.Text = ""; return; } ItemFacade itemFacade = new ItemFacade(); this.txtDQMCodeEdit.Text = pickDetail.DQMCode; txtScarpDQMCodeEdit.Text = pickDetail.DQMCode; Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(pickDetail.MCode); if (material != null) { this.txtMDescEdit.Text = material.MchlongDesc; } this.txtQtyEdit.Text = pickDetail.QTY.ToString("0.00"); txtPickLineEdit.Text = pickDetail.PickLine; txtInvLineEidt.Text = pickDetail.InvLine.ToString(); }
protected override void UpdateDomainObject(object domainObject) { if (facade == null) { facade = new InventoryFacade(base.DataProvider); } var pickDetail = (PickDetail)domainObject; try { this.DataProvider.BeginTransaction(); ItemFacade itemFacade = new ItemFacade(); Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(pickDetail.MCode); if (material != null) { material.MchlongDesc = this.txtMDescEdit.Text; itemFacade.UpdateMaterial(material); } this.facade.UpdatePickDetail(pickDetail); this.DataProvider.CommitTransaction(); WebInfoPublish.Publish(this, "更新成功", this.languageComponent1); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, ex.Message, this.languageComponent1); } }
private bool checkItemCode() { bool result = true; this._ItemFacade = new ItemFacade(this.DataProvider); Domain.MOModel.Material material = (Domain.MOModel.Material)_ItemFacade.GetMaterial(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeEdit.Text)), int.Parse(this.DropDownListOrg.SelectedValue)); if (material == null) { result = false; } return(result); }
private void ScarpDqmCodeChange() { ItemFacade itemFacade = new ItemFacade(); string dqmcode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtScarpDQMCodeEdit.Text, 40)); Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterialByDQMCode(dqmcode); if (material != null) { txtMDescEdit.Text = material.MchlongDesc; } else { txtMDescEdit.Text = " "; } }
//private void gridWebGrid_DblClick(object sender, Infragistics.WebUI.UltraWebGrid.ClickEventArgs e) //{ // object obj = this.GetEditObject(e.Row); // if (obj != null) // { // this.SetEditObject(obj); // this.buttonHelper.PageActionStatusHandle(PageActionType.Update); // } //} protected void cmdAdd_ServerClick(object sender, System.EventArgs e) { PageCheckManager checkManager = new PageCheckManager(); checkManager.Add(new LengthCheck(lblItemModelCodeEdit, drpModelEdit, Int32.MaxValue, true)); checkManager.Add(new LengthCheck(lblOrgEdit, DropDownListOrg, 8, true)); checkManager.Add(new NumberCheck(this.lblPcbAcountEdit, this.txtPcbAcountEdit, 0, int.MaxValue, false)); if (!checkManager.Check()) { WebInfoPublish.Publish(this, checkManager.CheckMessage, this.languageComponent1); return; } if (this.txtOPCodeEdit.Text.Trim().Length > 0) { WebInfoPublish.Publish(this, "$Error_NewItemNeedNotOP", this.languageComponent1); return; } object item = this.GetEditObject(); if (item != null) { if (_itemFacade == null) { _itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade(); } this._itemFacade.AddItem((Item)item, this.drpModelEdit.SelectedValue.ToUpper()); object objMaterial = this._itemFacade.GetMaterial(((Item)item).ItemCode.Trim().ToUpper(), Convert.ToInt32(this.DropDownListOrg.SelectedValue.Trim())); if (objMaterial == null) { Domain.MOModel.Material material = (Domain.MOModel.Material)(this.GetMaterialObject(((Item)item))); this._itemFacade.AddMaterial(material); } else { Domain.MOModel.Material material = (Domain.MOModel.Material)objMaterial; material.MaterialType = ((Item)item).ItemType; this._itemFacade.UpdateMaterial(material); } this.gridHelper.GridBind(this.pagerToolBar.PageIndex, this.pagerToolBar.PageSize); this.RequestData(); this.buttonHelper.PageActionStatusHandle(PageActionType.Add); this.drpModelEdit.SelectedIndex = 0; } }
//物料编码回车 //protected void btnMaterialNOEnter_Click(object sender, EventArgs e) //{ // ItemFacade itemFacade = new ItemFacade(this.DataProvider); // string dQMCode = FormatHelper.CleanString(this.txtMaterialNO.Text); // this.txtSpecialDescEdit.Text = ""; // this.txtMaterialENDesc.Text = ""; // this.txtMaterialCHDesc.Text = ""; // this.txtUnitEdit.Text = ""; // if (string.IsNullOrEmpty(dQMCode)) // { // WebInfoPublish.Publish(this, "物料编码为空", this.languageComponent1); // this.txtMaterialNO.Focus(); // return; // } // Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterialByDQMCode(dQMCode); // if (material == null) // { // WebInfoPublish.Publish(this, "物料主数据没有该物料编码: " + dQMCode, this.languageComponent1); // this.txtMaterialNO.Focus(); // return; // } // this.txtSpecialDescEdit.Text = material.MspecialDesc; // this.txtMaterialENDesc.Text = material.MenshortDesc; // this.txtMaterialCHDesc.Text = material.MchshortDesc; // this.txtUnitEdit.Text = material.Muom; //} protected void cmdOK_ServerClick(object sender, System.EventArgs e) { ItemFacade itemFacade = new ItemFacade(this.DataProvider); string dQMCode = FormatHelper.CleanString(this.txtMaterialNO.Text); this.txtSpecialDescEdit.Text = ""; this.txtMaterialENDesc.Text = ""; this.txtMaterialCHDesc.Text = ""; this.txtUnitEdit.Text = ""; if (string.IsNullOrEmpty(dQMCode)) { WebInfoPublish.Publish(this, "物料编码为空", this.languageComponent1); this.txtMaterialNO.Focus(); return; } if (string.IsNullOrEmpty(drpStorageOutEdit.SelectedValue)) { WebInfoPublish.Publish(this, "库位编码不能为空!", this.languageComponent1); return; } if (string.IsNullOrEmpty(drpLoationOutEdit.SelectedValue)) { WebInfoPublish.Publish(this, "货位编码不能为空!", this.languageComponent1); return; } _InventoryFacade = new InventoryFacade(base.DataProvider); SpecInOut inOut = _InventoryFacade.QuerySpecInOuts(dQMCode, drpStorageOutEdit.SelectedValue, drpLoationOutEdit.SelectedValue); Domain.MOModel.Material material = (Domain.MOModel.Material)_InventoryFacade.GetMaterialByDQMCode(dQMCode); if (material == null) { WebInfoPublish.Publish(this, "物料主数据没有该物料编码! " + dQMCode, this.languageComponent1); this.txtMaterialNO.Focus(); return; } if (inOut == null) { WebInfoPublish.Publish(this, "没有对应的入库记录!", this.languageComponent1); this.txtMaterialNO.Focus(); } this.txtSpecialDescEdit.Text = inOut.InOutDesc; this.txtMaterialENDesc.Text = material.MenshortDesc; this.txtMaterialCHDesc.Text = material.MchshortDesc; this.txtUnitEdit.Text = material.Muom; }
protected override DataRow GetGridRow(object obj) { DataRow row = this.DtSource.NewRow(); StorageDetailValidity s = (StorageDetailValidity)obj; InventoryFacade _InventoryFacade = new InventoryFacade(base.DataProvider); Domain.MOModel.Material m = (Domain.MOModel.Material)_InventoryFacade.GetMaterialByDQMCode(s.DQMCode); row["StorageCode"] = s.StorageCode; row["LocationCode"] = s.LocationCode; row["Cartonno"] = s.CartonNo; row["DQMCode"] = s.DQMCode; row["DHCode"] = string.Empty; row["MDESC"] = m.MchlongDesc; row["ValidityCount"] = s.ValidityCount; row["ValidityQTY"] = s.StorageQty; return(row); }
protected override string[] FormatExportRecord(object obj) { _IQCFacade = new IQCFacade(base.DataProvider); string IQCNO = ((AsnIQCExt)obj).IqcNo; _InventoryFacade = new InventoryFacade(this.DataProvider); string desc = string.Empty; Domain.MOModel.Material m = (Domain.MOModel.Material)_InventoryFacade.GetMaterialByDQMCode(((AsnIQCExt)obj).DQMCode); if (m != null) { desc = m.MchlongDesc; } return(new string[] { ((AsnIQCExt)obj).IqcNo, ((AsnIQCExt)obj).StNo, this.GetInvInName(((AsnIQCExt)obj).StType), ((AsnIQCExt)obj).InvNo, ((AsnIQCExt)obj).STORAGECODE, ((AsnIQCExt)obj).DQMCode, desc, ((AsnIQCExt)obj).StType == "UB" ? ((AsnIQCExt)obj).CustmCode : ((AsnIQCExt)obj).VendorMCode, this.GetStatusName(((AsnIQCExt)obj).Status), FormatHelper.GetChName(((AsnIQCExt)obj).IqcType), ((AsnIQCExt)obj).QcStatus == "Y" ? "合格" : (((AsnIQCExt)obj).QcStatus == "N" ? "不合格" : ""), ((AsnIQCExt)obj).AppQty.ToString(), ((AsnIQCExt)obj).NgQty.ToString(), _IQCFacade.ReturnQtyTotalWithIQCNO(IQCNO).ToString(), _IQCFacade.ReformQtyTotalWithIQCNO(IQCNO).ToString(), _IQCFacade.GiveQtyTotalWithIQCNO(IQCNO).ToString(), _IQCFacade.AcceptQtyTotalWithIQCNO(IQCNO).ToString(), ((AsnIQCExt)obj).VendorCode, FormatHelper.ToDateString(((AsnIQCExt)obj).AppDate, "/") }); }
private void edtMoCode_TxtboxKeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { string moCode = FormatHelper.CleanString(this.edtMoCode.Value.Trim().ToUpper()); if (string.IsNullOrEmpty(moCode)) { this.edtMoCode.TextFocus(true, true); return; } ItemFacade itemFacade = new ItemFacade(this.DataProvider); Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterialWithMoCode(moCode); if (material != null) { this.edtitemDesc.Value = material.MaterialName; } this.LoadData(); this.edtCarton.TextFocus(true, true); } }
protected void txtDQMCodeEdit_TextChanged(object sender, EventArgs e) { ItemFacade itemFacade = new ItemFacade(); if (facade == null) { facade = new InventoryFacade(base.DataProvider); } txtInvLineEidt.Text = ""; if (!string.IsNullOrEmpty(this.txtDQMCodeEdit.Text)) { if (!IsInt(this.txtDQMCodeEdit.Text)) { return; } txtInvLineEidt.Text = this.txtDQMCodeEdit.Text; int invline = Convert.ToInt32(this.txtDQMCodeEdit.Text); string invno = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtInvNoEidt.Text, 40)); InvoicesDetail invoicesDetail = (InvoicesDetail)facade.GetInvoicesDetail(invno, invline); if (invoicesDetail != null) { string dqmcode = invoicesDetail.DQMCode; this.txtDQMCodeEdit.Text = dqmcode; this.txtCustmCodeEdit.Text = invoicesDetail.CustmCode; //FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtDQMCodeEdit.Text, 40)); Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterialByDQMCode(dqmcode); if (material != null) { txtMDescEdit.Text = material.MchlongDesc; } else { txtMDescEdit.Text = " "; } } } }
private Messages LoadData(string rcard) { Messages msg = new Messages(); _DataTableLoadedPart.Clear(); MOFacade moFacade = new MOFacade(this.DataProvider); OPBOMFacade opBOMFacade = new OPBOMFacade(this.DataProvider); MaterialFacade materialFacade = new MaterialFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); //根据当前的序列号获取产品原始的序列号 DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(rcard, string.Empty); //Get Product Info ProductInfo product = GetProduct(sourceRCard); if (product == null || product.LastSimulation == null) { msg.Add(new UserControl.Message(MessageType.Error, "$NoSimulation")); return(msg); } // Marked By HI1/Venus.Feng on 20081013 for Hisense Version : GOOD can do drop /* * if (product.LastSimulation.ProductStatus != ProductStatus.NG) * { * msg.Add(new UserControl.Message(MessageType.Error, "$DropMaterial_Need_NG")); * return msg; * } */ // End Marked //Get loaded parts OnWIPItem[] onWIPItems = materialFacade.QueryLoadedPartByRCard(product.LastSimulation.RunningCard, string.Empty); if (onWIPItems == null) { msg.Add(new UserControl.Message(MessageType.Error, "$DropMaterial_Need_CINNO")); return(msg); } try { if (onWIPItems != null) { for (int i = 0; i < onWIPItems.Length; i++) { MO mo = (MO)moFacade.GetMO(onWIPItems[i].MOCode); int orgID = GlobalVariables.CurrentOrganizations.First().OrganizationID; if (mo != null) { orgID = mo.OrganizationID; } Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(onWIPItems[i].MItemCode, orgID); //changed by hiro 08/11/04 if (material != null) { _DataTableLoadedPart.Rows.Add(new object[] { false, false, string.Empty, i + 1, onWIPItems[i].MItemCode, onWIPItems[i].MOCode, onWIPItems[i].MCARD, material.MaterialDescription == null ? "" : material.MaterialDescription, string.Empty, onWIPItems[i].MCardType }); } //end by hiro } } } catch (Exception E) { msg.Add(new UserControl.Message(E)); } return(msg); }
protected override object GetEditObject() { if (this.ValidateInput()) { if (facade == null) { facade = new InventoryFacade(base.DataProvider); } ItemFacade itemFacade = new ItemFacade(); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); string pickno = FormatHelper.CleanString(this.txtPickNoQuery.Text, 40); string pickline = FormatHelper.CleanString(this.txtPickLineEdit.Text, 40); string dqmcode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtDQMCodeEdit.Text, 40)); string custMCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtCustmCodeEdit.Text, 40)); if (txtPickTypeQuery.Text == PickType.PickType_BFC) //BFC:报废 { dqmcode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtScarpDQMCodeEdit.Text, 40)); } string mdesc = FormatHelper.CleanString(this.txtMDescEdit.Text); int invline = 0; PickDetail pickDetail = (PickDetail)facade.GetPickDetail(pickno, pickline); if (pickDetail == null) { pickDetail = new PickDetail(); int maxpickline = facade.GetMaxPickLine1(pickno); pickDetail.PickNo = pickno; pickDetail.PickLine = (maxpickline + 1).ToString(); #region MCode Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterialByDQMCode(dqmcode); if (material != null) { pickDetail.MCode = material.MCode; pickDetail.Unit = material.Muom; } else { pickDetail.MCode = " "; pickDetail.Unit = string.Empty; } #endregion //根据鼎桥物料编码在物料表(TBLMATERIAL)带出TBLMATERIAL.MCODE值 pickDetail.MaintainUser = this.GetUserCode(); pickDetail.MaintainDate = dbDateTime.DBDate; pickDetail.MaintainTime = dbDateTime.DBTime; pickDetail.CUser = this.GetUserCode(); pickDetail.CDate = dbDateTime.DBDate; pickDetail.CTime = dbDateTime.DBTime; pickDetail.Status = PickHeadStatus.PickHeadStatus_Release;//Release:初始化 //pickDetail.CustMCode = custMCode; } if (!string.IsNullOrEmpty(txtInvLineEidt.Text)) { invline = Convert.ToInt32(this.txtInvLineEidt.Text); pickDetail.InvLine = invline; } pickDetail.MDesc = mdesc; pickDetail.DQMCode = dqmcode; pickDetail.CustMCode = custMCode; string qty = FormatHelper.CleanString(this.txtQtyEdit.Text, 40); if (!string.IsNullOrEmpty(qty)) { if (IsDecimal(qty)) { pickDetail.QTY = decimal.Parse((decimal.Parse(qty)).ToString("0.00")); } } else { pickDetail.QTY = 0; } return(pickDetail); } else { return(null); } }
protected override DataRow GetGridRow(object obj) { if (facade == null) { facade = new WarehouseFacade(base.DataProvider); } DataRow row = this.DtSource.NewRow(); IQCDetailRecord s = (IQCDetailRecord)obj; InventoryFacade _InventoryFacade = new InventoryFacade(base.DataProvider); Domain.MOModel.Material m = (Domain.MOModel.Material)_InventoryFacade.GetMaterialByDQMCode(s.DQMCODE); row["IQCNO"] = s.IQCNO; row["INVNO"] = s.INVNO; row["STTYPE"] = this.GetInvInName(s.STTYPE); row["StorageCode"] = s.StorageCode; row["VENDORCODE"] = s.VENDORCODE; row["VendorName"] = s.VendorName; row["DQMCODE"] = s.DQMCODE; row["VENDORMCODE"] = s.VENDORMCODE; row["MDESC1111"] = m.MchlongDesc; row["IQCTYPE"] = s.IQCTYPE; row["AQLLEVEL"] = s.AQLLEVEL; row["QTY"] = s.QTY; row["IQCQTY"] = s.SAMPLESIZE; row["NGQTY"] = s.NGQTY; row["RETURNQTY"] = s.RETURNQTY; row["ReformQTY"] = s.ReformQTY; row["GiveQTY"] = s.GiveQTY; row["AcceptQTY"] = s.AcceptQTY; SystemSettingFacade _SystemSettingFacade = new SystemSettingFacade(base.DataProvider); object[] objs = _SystemSettingFacade.GetErrorGroupcode(); if (objs != null && objs.Length > 0) { foreach (ErrorCodeGroupA ecg in objs) { row[ecg.ErrorCodeGroup] = facade.GetErrorGroupNum(s.IQCNO, ecg.ErrorCodeGroup); } } row["CDATE"] = FormatHelper.ToDateString(s.CDATE); InvInOutTrans OCFinishInv = facade.QCFinishDateTimeTrans(s.IQCNO); InvInOutTrans SQEFinishInv = facade.SQEFinishDateTimeTrans(s.IQCNO); InvInOutTrans IQCFinishInv = SQEFinishInv ?? (OCFinishInv ?? null); row["QCFINISHDATE"] = OCFinishInv != null?FormatHelper.ToDateString(OCFinishInv.MaintainDate) : string.Empty; row["SEQFINISHDATE"] = SQEFinishInv != null?FormatHelper.ToDateString(SQEFinishInv.MaintainDate) : string.Empty; row["IQCFINISHDATE"] = IQCFinishInv != null?FormatHelper.ToDateString(IQCFinishInv.MaintainDate) : string.Empty; row["QCDATERANGE"] = OCFinishInv != null?Common.Totalday(OCFinishInv.MaintainDate, OCFinishInv.MaintainTime, s.CDATE, s.CTIME) : 0; if (OCFinishInv != null && SQEFinishInv != null) { row["IQCSEQDATERANGE"] = Common.Totalday(SQEFinishInv.MaintainDate, SQEFinishInv.MaintainTime, OCFinishInv.MaintainDate, OCFinishInv.MaintainTime); } else { row["IQCSEQDATERANGE"] = string.Empty; } if (IQCFinishInv != null) { row["IQCDATERANGE"] = Common.Totalday(IQCFinishInv.MaintainDate, IQCFinishInv.MaintainTime, s.CDATE, s.CTIME); } else { row["IQCDATERANGE"] = string.Empty; } return(row); }
//protected override void gridWebGrid_ItemCommand(GridRecord row, string commandName) //{ // if (commandName == "Edit") // { // object obj = this.GetEditObject(row); // if (obj != null) // { // this.SetEditObject(obj); // this.buttonHelper.PageActionStatusHandle(PageActionType.Update); // } // } // else if (commandName == "LinkDetail") // { // string pickNo = row.Items.FindItemByKey("PickNo").Text.Trim(); // //string storageOut = row.Items.FindItemByKey("StorageOut").Text.Trim(); // Response.Redirect(this.MakeRedirectUrl("FCreatePickLineMP.aspx", new string[] { "ACT", "PickNo" }, new string[] { "LinkDetail", pickNo })); // } //} protected override void cmdExport_Click(object sender, EventArgs e) { BenQGuru.eMES.Material.WarehouseFacade _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider); List <string> ca = new List <string>(); XlsPackage xls = new XlsPackage(); IFont font = xls.Black; font.FontHeightInPoints = 10; ICellStyle style = xls.Normal; style.SetFont(font); xls.CreateSheet("IQC明细表"); xls.NewRow(0); xls.Cell(0, "IQC单号", style); xls.Cell(1, "SAP单据号", style); //xls.Cell(2, "SAP单据号", style); xls.Cell(2, "入库类型", style); xls.Cell(3, "库位", style); xls.Cell(4, "供应商代码", style); xls.Cell(5, "供应商名称", style); xls.Cell(6, "鼎桥物料编码", style); xls.Cell(7, "供应商物料编码", style); xls.Cell(8, "鼎桥物料描述", style); xls.Cell(9, "检验方式", style); xls.Cell(10, "AQL标准", style); xls.Cell(11, "来料数量", style); xls.Cell(12, "样本数量", style); xls.Cell(13, "缺陷品数", style); xls.Cell(14, "退换货数量", style); xls.Cell(15, "现场整改数量", style); xls.Cell(16, "让步接收数量", style); xls.Cell(17, "特采放行数量", style); int cellNum = 18; SystemSettingFacade _SystemSettingFacade = new SystemSettingFacade(base.DataProvider); object[] objs = _SystemSettingFacade.GetErrorGroupcode(); if (objs != null && objs.Length > 0) { foreach (ErrorCodeGroupA ecg in objs) { xls.Cell(cellNum, ecg.ErrorCodeGroupDescription, style); cellNum++; } } xls.Cell(cellNum++, "创建时间", style); xls.Cell(cellNum++, "QC检验完成时间", style); xls.Cell(cellNum++, "SQE判定完成时间", style); xls.Cell(cellNum++, "IQC检验完成时间", style); xls.Cell(cellNum++, "QC检验执行时间", style); xls.Cell(cellNum++, "SQE判定执行时间", style); xls.Cell(cellNum++, "IQC检验执行时间", style); int rowNum = 1; IQCDetailRecord[] iqcs = _WarehouseFacade.QueryIQCs(this.txtStorageCodeQuery.Text, this.txtVendorCodeQuery.Text, this.drpStorageInTypeQuery.SelectedValue, FormatHelper.TODateInt(dateInDateFromQuery.Text), FormatHelper.TODateInt(dateInDateToQuery.Text)); InventoryFacade _InventoryFacade = new InventoryFacade(base.DataProvider); for (int i = 0; i < iqcs.Length; i++) { xls.NewRow(rowNum); string iqcNO = iqcs[i].IQCNO; xls.Cell(0, iqcNO, style); string invNo = iqcs[i].INVNO; xls.Cell(1, invNo, style); string stType = iqcs[i].STTYPE; xls.Cell(2, stType, style); string StorageCode = iqcs[i].StorageCode; xls.Cell(3, StorageCode, style); string VENDORCODE = iqcs[i].VENDORCODE; xls.Cell(4, VENDORCODE, style); string VendorName = iqcs[i].VendorName; xls.Cell(5, VendorName, style); string DQMCODE = iqcs[i].DQMCODE; xls.Cell(6, DQMCODE, style); string VENDORMCODE = iqcs[i].VENDORMCODE; xls.Cell(7, VENDORMCODE, style); Domain.MOModel.Material m = (Domain.MOModel.Material)_InventoryFacade.GetMaterialByDQMCode(iqcs[i].DQMCODE); string MDESC = m.MchlongDesc; xls.Cell(8, MDESC, style); string IQCTYPE = iqcs[i].IQCTYPE; xls.Cell(9, IQCTYPE, style); string AQLLEVEL = iqcs[i].AQLLEVEL; xls.Cell(10, AQLLEVEL, style); string QTY = iqcs[i].QTY.ToString(); xls.Cell(11, QTY, style); string IQCQTY = iqcs[i].SAMPLESIZE.ToString(); xls.Cell(12, IQCQTY, style); string NGQTY = iqcs[i].NGQTY.ToString(); xls.Cell(13, NGQTY, style); string RETURNQTY = iqcs[i].RETURNQTY.ToString(); xls.Cell(14, RETURNQTY, style); string ReformQTY = iqcs[i].ReformQTY.ToString(); xls.Cell(15, ReformQTY, style); string GiveQTY = iqcs[i].GiveQTY.ToString(); xls.Cell(16, GiveQTY, style); string AcceptQTY = iqcs[i].AcceptQTY.ToString(); xls.Cell(17, AcceptQTY, style); int cellNum2 = 18; if (objs != null && objs.Length > 0) { foreach (ErrorCodeGroupA ecg in objs) { int num = _WarehouseFacade.GetErrorGroupNum(iqcs[i].IQCNO, ecg.ErrorCodeGroup); xls.Cell(cellNum2, num, style); cellNum2++; } } string CDATE = iqcs[i].CDATE.ToString(); xls.Cell(cellNum2++, CDATE, style); InvInOutTrans OCFinishInv = _WarehouseFacade.QCFinishDateTimeTrans(iqcs[i].IQCNO); InvInOutTrans SQEFinishInv = _WarehouseFacade.SQEFinishDateTimeTrans(iqcs[i].IQCNO); InvInOutTrans IQCFinishInv = SQEFinishInv ?? (OCFinishInv ?? null); string QCFINISHDATEStr = OCFinishInv != null?FormatHelper.ToDateString(OCFinishInv.MaintainDate) : string.Empty; string SEQFINISHDATEStr = SQEFinishInv != null?FormatHelper.ToDateString(SQEFinishInv.MaintainDate) : string.Empty; string IQCFINISHDATEStr = IQCFinishInv != null?FormatHelper.ToDateString(IQCFinishInv.MaintainDate) : string.Empty; decimal QCDATERANGE = OCFinishInv != null?Common.Totalday(OCFinishInv.MaintainDate, OCFinishInv.MaintainTime, iqcs[i].CDATE, iqcs[i].CTIME) : (decimal)0; string IQCSEQDATERANGE = string.Empty; string IQCDATERANGEStr = string.Empty; if (OCFinishInv != null && SQEFinishInv != null) { IQCSEQDATERANGE = Common.Totalday(SQEFinishInv.MaintainDate, SQEFinishInv.MaintainTime, OCFinishInv.MaintainDate, OCFinishInv.MaintainTime).ToString(); } if (IQCFinishInv != null) { IQCDATERANGEStr = Common.Totalday(IQCFinishInv.MaintainDate, IQCFinishInv.MaintainTime, iqcs[i].CDATE, iqcs[i].CTIME).ToString(); } xls.Cell(cellNum2++, QCFINISHDATEStr, style); xls.Cell(cellNum2++, SEQFINISHDATEStr, style); xls.Cell(cellNum2++, IQCFINISHDATEStr, style); xls.Cell(cellNum2++, QCDATERANGE.ToString(), style); xls.Cell(cellNum2++, IQCSEQDATERANGE, style); xls.Cell(cellNum2++, IQCDATERANGEStr, style); rowNum++; } string filename = string.Format("Export_{0}_{1}.{2}", FormatHelper.TODateInt(System.DateTime.Now).ToString(), FormatHelper.TOTimeInt(System.DateTime.Now).ToString(), "xls"); string filepath = string.Format(@"{0}{1}", this.DownloadPhysicalPath, filename); FileStream file = new FileStream(filepath, FileMode.Create, FileAccess.ReadWrite); xls.Save(file); file.Close(); DownLoadFile1(filename); }
protected override DataRow GetGridRow(object obj) { if (_IQCFacade == null) { _IQCFacade = new IQCFacade(base.DataProvider); } if (_InventoryFacade == null) { _InventoryFacade = new InventoryFacade(base.DataProvider); } DataRow row = this.DtSource.NewRow(); row["IQCNo"] = ((AsnIQCExt)obj).IqcNo; row["StorageInASN"] = ((AsnIQCExt)obj).StNo; row["StorageInType"] = this.GetInvInName(((AsnIQCExt)obj).StType);//入库类型(单据类型) row["SAPInvNo"] = ((AsnIQCExt)obj).InvNo; row["STORAGECODE1234"] = ((AsnIQCExt)obj).STORAGECODE; row["DQMCode"] = ((AsnIQCExt)obj).DQMCode; Domain.MOModel.Material m = (Domain.MOModel.Material)_InventoryFacade.GetMaterialByDQMCode(((AsnIQCExt)obj).DQMCode); if (m != null) { row["DQMCODEDESC"] = m.MchlongDesc; } else { row["DQMCODEDESC"] = string.Empty; } row["VMCode"] = ((AsnIQCExt)obj).StType == "UB" ? ((AsnIQCExt)obj).CustmCode : ((AsnIQCExt)obj).VendorMCode; row["Status"] = this.GetStatusName(((AsnIQCExt)obj).Status); row["IQCStatus"] = ((AsnIQCExt)obj).Status; row["IQCType"] = FormatHelper.GetChName(((AsnIQCExt)obj).IqcType); if (((AsnIQCExt)obj).IqcType == "SpotCheck") { row["AQLResult"] = FormatHelper.GetChName(((AsnIQCExt)obj).QcStatus); } row["AppQty"] = ((AsnIQCExt)obj).AppQty; row["NGQty"] = ((AsnIQCExt)obj).NgQty; string IQCNO = ((AsnIQCExt)obj).IqcNo; row["ReturnQty"] = _IQCFacade.ReturnQtyTotalWithIQCNO(IQCNO); row["ReformQty"] = _IQCFacade.ReformQtyTotalWithIQCNO(IQCNO); row["GiveQty"] = _IQCFacade.GiveQtyTotalWithIQCNO(IQCNO); row["AcceptQty"] = _IQCFacade.AcceptQtyTotalWithIQCNO(IQCNO); row["VendorNo"] = ((AsnIQCExt)obj).VendorCode; row["AppDate"] = FormatHelper.ToDateString(((AsnIQCExt)obj).AppDate, "/"); return(row); }
public Messages DeductQty(ActionEventArgs actionEventArgs, DataCollectFacade dataCollectFacade, MINNO minno) { SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider); MaterialFacade materialFacade = new MaterialFacade(this.DataProvider); MOFacade moFacade = new MOFacade(this.DataProvider); OPBOMFacade opbomFacade = new OPBOMFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider); LotSimulation simulation = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulation; LotSimulationReport simulationReport = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulationReport; Messages returnValue = new Messages(); string lotNoList = string.Empty;// add by Jarvis For onWipItem ProductInfo productionInfo = actionEventArgs.ProductInfo; LotSimulation sim = actionEventArgs.ProductInfo.NowSimulation; int orgid = actionEventArgs.ProductInfo.Resource.OrganizationID; MO mo = actionEventArgs.ProductInfo.CurrentMO; if (mo == null) { mo = moFacade.GetMO(sim.MOCode) as MO; } //获取当前工单号 string moCode = productionInfo.NowSimulation.MOCode; //获取当前工序号 string opCode = productionInfo.NowSimulation.OPCode; //获取当前产品号 string itemCode = productionInfo.NowSimulation.ItemCode; //获取途程代码 string routeCode = productionInfo.NowSimulation.RouteCode; string resCode = productionInfo.Resource.ResourceCode; //获取ORGID int orgID = productionInfo.Resource.OrganizationID; string moBomVer = string.Empty; object objMo = moFacade.GetMO(moCode); if (objMo != null) { moBomVer = (objMo as MO).BOMVersion; } //获取物料名称 string MItemName = string.Empty; Domain.MOModel.Material material = ((Domain.MOModel.Material)itemFacade.GetMaterial(minno.MItemCode, orgID)); if (material != null) { MItemName = material.MaterialName; } //添加产品已上料扣料判断 tblonwip string lotNo = productionInfo.NowSimulation.LotCode; decimal seq = productionInfo.NowSimulation.LotSeq; //object[] objOnWip = dataCollectFacade.QueryLotOnWIP(lotNo, moCode, opCode, "CINNO"); //if (objOnWip != null && objOnWip.Length > 0) //{ // return returnValue; //} //remove by Jarvis 不检查工单BOM 20120321 //object[] objMoBoms = moFacade.QueryMoBom(sim.ItemCode, minno.MItemCode, sim.MOCode);//检查工单BOM是否有该首选料, Jarvis 20120319 //if (objMoBoms == null) //{ // throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$Error_NotExistInMoBOM" + String.Format("[$MOCode='{0}']", sim.MOCode)); //} object[] opbomObjs = opbomFacade.QueryOPBOMDetail(sim.ItemCode, minno.MItemCode, string.Empty, string.Empty, string.Empty, sim.RouteCode, opCode, (int)MaterialType.CollectMaterial, int.MinValue, int.MaxValue, orgid, true); if (opbomObjs == null) { throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$Error_NotExistInOPBOM" + String.Format("[$ItemCode='{0}']", sim.ItemCode)); } object[] moRouteObjs = moFacade.QueryMORoutes(sim.MOCode, sim.RouteCode); if (moRouteObjs == null) { throw new Exception("$Error_MORouteNOExist"); } bool iflag = false; decimal iOPBOMItemQty = 0; //需要比对的子阶料料号 比对成功的 只在工单生产BOM 中 if (opbomObjs == null)//去掉检查工单BOM是否为空 { return(returnValue); } //以工单标准BOM为基准,扣减当前工单的倒冲库存地(tblmo. EATTRIBUTE2)中相对应的库存信息 //for (int n = 0; n < objMoBoms.Length; n++)//去掉工单BOM 20120321 Jarvis //{ //求得opbom中对应的料品 string TempMOBOMItemCode = minno.MItemCode; iflag = false; iOPBOMItemQty = 0; for (int j = 0; j < opbomObjs.Length; j++) { if (TempMOBOMItemCode.ToUpper() == ((OPBOMDetail)opbomObjs[j]).OPBOMItemCode.ToUpper() || TempMOBOMItemCode.ToUpper() == ((OPBOMDetail)opbomObjs[j]).OPBOMSourceItemCode.ToUpper()) { //子阶料存在或有替代料可用 iflag = true; //TempMOBOMItemCode = ((OPBOMDetail)opbomObjs[j]).OPBOMItemCode;//remove by Jarvis 20120316 //For 替代料,记录首选料号,Jarvis 20120316 //TempMOBOMItemCode = ((MOBOM)objMoBoms[n]).MOBOMItemCode; iOPBOMItemQty = (decimal)((OPBOMDetail)opbomObjs[j]).OPBOMItemQty; iOPBOMItemQty *= sim.LotQty; break; } } //比对成功:子阶料料号一致 if (iflag)//子阶料不存在, 即只在工单标准bom中 { //object[] objInfos = inventoryFacade.QueryStorageInfoByIDAndMCode(mo.EAttribute2, TempMOBOMItemCode.ToUpper()); object[] objInfos = inventoryFacade.QueryStorageInfoByIDAndMCode(TempMOBOMItemCode.ToUpper()); if (objInfos == null) { throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$CS_StorageQty_ERROR"); } //获取物料的总库存数,Jarvis 20120316 //decimal total = inventoryFacade.GetStorageQty(mo.EAttribute2, TempMOBOMItemCode.ToUpper()); decimal total = inventoryFacade.GetStorageQty(TempMOBOMItemCode.ToUpper()); if (total < iOPBOMItemQty) { throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$CS_StorageQty_ERROR"); } #region //先判断备料批号中的数据量,不够扣减就退出 decimal temlotQty = 0; object[] objStorageLotInfo = null; ArrayList StorageLotInfoList = new ArrayList(); //获取子阶料的备料信息,Jarvis 20120316,按Seq排序 object[] minnoss = materialFacade.QueryMINNO_New(moCode, routeCode, opCode, resCode, moBomVer, minno.MSourceItemCode); //获取同一首选料的备料信息,Jarvis 20120321 //获取备料信息中可扣减数,Jarvis 20120316 foreach (MINNO temp in minnoss) { //objStorageLotInfo = inventoryFacade.QueryStorageLot(temp.LotNO, mo.EAttribute2, temp.MItemCode); objStorageLotInfo = inventoryFacade.QueryStorageLot(temp.LotNO, temp.MItemCode); if (objStorageLotInfo != null) { foreach (StorageLotInfo lotInfo in objStorageLotInfo) { temlotQty += lotInfo.Lotqty; if (lotInfo.Lotqty <= 0) //如果批数量为0不记录该批 { continue; } StorageLotInfoList.Add(lotInfo); } } } if (temlotQty < iOPBOMItemQty) { throw new Exception("$CS_ItemCode[" + minno.MItemCode + "-" + MItemName + "]" + "$CS_DeductQty_ERROR"); } #endregion #region 数量可以扣减 foreach (StorageLotInfo lotInfo in StorageLotInfoList) { if (iOPBOMItemQty > lotInfo.Lotqty) { iOPBOMItemQty = iOPBOMItemQty - lotInfo.Lotqty; inventoryFacade.DeleteStorageLotInfo(lotInfo); this.UpdateStorageQty(lotInfo, inventoryFacade, lotInfo.Lotqty); lotNoList += ("," + lotInfo.Lotno + ","); #region 记录过账信息 LotOnWipItem wipItem = new LotOnWipItem(); MINNO minnoTemp = null; object[] minnoTemps = materialFacade.QueryMINNO(moCode, routeCode, opCode, resCode, moBomVer, lotInfo.Mcode, minno.MSourceItemCode, lotInfo.Lotno); if (minnoTemps != null) { minnoTemp = (MINNO)minnoTemps[0]; } wipItem.DateCode = minnoTemp.DateCode; wipItem.LOTNO = minnoTemp.LotNO; wipItem.MItemCode = minnoTemp.MItemCode; wipItem.VendorCode = minnoTemp.VendorCode; wipItem.VendorItemCode = minnoTemp.VendorItemCode; wipItem.Version = minnoTemp.Version; wipItem.MSeq = seqForDeductQty; wipItem.MCardType = minno.EAttribute1; wipItem.Eattribute1 = simulation.EAttribute1; wipItem.ItemCode = simulation.ItemCode; wipItem.ResCode = simulation.ResCode; wipItem.RouteCode = simulation.RouteCode; wipItem.LotCode = simulation.LotCode; wipItem.LotSeq = simulation.LotSeq; wipItem.SegmentCode = simulationReport.SegmentCode; wipItem.BeginShiftCode = simulationReport.BeginShiftCode; wipItem.ShiftTypeCode = simulationReport.ShiftTypeCode; wipItem.StepSequenceCode = simulationReport.StepSequenceCode; wipItem.BeginTimePeriodCode = simulationReport.BeginTimePeriodCode; wipItem.MOCode = simulation.MOCode; wipItem.ModelCode = simulation.ModelCode; wipItem.OPCode = simulation.OPCode; wipItem.CollectStatus = simulation.CollectStatus; wipItem.BeginDate = simulation.BeginDate; wipItem.BeginTime = simulation.BeginTime; wipItem.MaintainUser = simulation.MaintainUser; wipItem.TransStatus = TransactionStatus.TransactionStatus_YES; wipItem.Qty = lotInfo.Lotqty; wipItem.ActionType = (int)MaterialType.CollectMaterial; wipItem.MOSeq = simulation.MOSeq; dataCollectFacade.AddLotOnWIPItem(wipItem); LotSimulationReport simulationRpt = dataCollectFacade.GetLastLotSimulationReport(wipItem.LotCode); if (simulationRpt != null) { dataCollectFacade.UpdateLotSimulationReport(simulationRpt); } seqForDeductQty++; #endregion } else { lotInfo.Lotqty = lotInfo.Lotqty - iOPBOMItemQty; inventoryFacade.UpdateStorageLotInfo(lotInfo); this.UpdateStorageQty(lotInfo, inventoryFacade, iOPBOMItemQty); #region 记录过账信息 LotOnWipItem wipItem = new LotOnWipItem(); MINNO minnoTemp = null; object[] minnoTemps = materialFacade.QueryMINNO(moCode, routeCode, opCode, resCode, moBomVer, lotInfo.Mcode, minno.MSourceItemCode, lotInfo.Lotno); if (minnoTemps != null) { minnoTemp = (MINNO)minnoTemps[0]; } wipItem.DateCode = minnoTemp.DateCode; wipItem.LOTNO = minnoTemp.LotNO; wipItem.MItemCode = minnoTemp.MItemCode; wipItem.VendorCode = minnoTemp.VendorCode; wipItem.VendorItemCode = minnoTemp.VendorItemCode; wipItem.Version = minnoTemp.Version; wipItem.MSeq = seqForDeductQty; wipItem.MCardType = minno.EAttribute1; wipItem.Eattribute1 = simulation.EAttribute1; wipItem.ItemCode = simulation.ItemCode; wipItem.ResCode = simulation.ResCode; wipItem.RouteCode = simulation.RouteCode; wipItem.LotCode = simulation.LotCode; wipItem.LotSeq = simulation.LotSeq; wipItem.SegmentCode = simulationReport.SegmentCode; wipItem.BeginShiftCode = simulationReport.BeginShiftCode; wipItem.ShiftTypeCode = simulationReport.ShiftTypeCode; wipItem.StepSequenceCode = simulationReport.StepSequenceCode; wipItem.BeginTimePeriodCode = simulationReport.BeginTimePeriodCode; wipItem.MOCode = simulation.MOCode; wipItem.ModelCode = simulation.ModelCode; wipItem.OPCode = simulation.OPCode; wipItem.CollectStatus = simulation.CollectStatus; wipItem.BeginDate = simulation.BeginDate; wipItem.BeginTime = simulation.BeginTime; wipItem.MaintainUser = simulation.MaintainUser; wipItem.TransStatus = TransactionStatus.TransactionStatus_YES; wipItem.Qty = iOPBOMItemQty; wipItem.ActionType = (int)MaterialType.CollectMaterial; wipItem.MOSeq = simulation.MOSeq; dataCollectFacade.AddLotOnWIPItem(wipItem); LotSimulationReport simulationRpt = dataCollectFacade.GetLastLotSimulationReport(wipItem.LotCode); if (simulationRpt != null) { dataCollectFacade.UpdateLotSimulationReport(simulationRpt); } seqForDeductQty++; #endregion iOPBOMItemQty = 0; lotNoList += ("," + lotInfo.Lotno + ","); break; } } #endregion } //} return(returnValue); }
public string Commit_Click(string userCode, string statusList, string transNo, string tLocationCode, string fromCarton, string tcarton, string inputsn, string inputqty) { string msg; #region facade InventoryFacade facade = new InventoryFacade(this.DataProvider); if (_WarehouseFacade == null) { _WarehouseFacade = new WarehouseFacade(this.DataProvider); } ItemFacade itemFacade = new ItemFacade(); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); #endregion #region check if (string.IsNullOrEmpty(transNo)) { msg = "移转单号不能为空"; return(msg); } StorageDetail storageCarton = (StorageDetail)facade.GetStorageDetail(fromCarton); if (storageCarton == null) { //A 根据原箱号和数量操作。根据原箱号(cartonno)到TBLStorageDetail中查找数据。没有报错。 msg = "转储单中没有对应的原箱号"; return(msg); } if (string.IsNullOrEmpty(tLocationCode)) { msg = "目标货位不能为空"; return(msg); } if (string.IsNullOrEmpty(tcarton)) { msg = "目标箱号不能为空"; return(msg); } Storloctrans storloctrans = (Storloctrans)_WarehouseFacade.GetStorloctrans(transNo); if (storloctrans == null) { msg = "移转单号不存在"; return(msg); } #endregion string msgsn = ""; StorageDetail fromStorageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(fromCarton); StorageDetail toStorageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(tcarton); if (fromStorageDetail == null) { return("原箱号在库存中不存在!"); } StorloctransDetail storloctransdetailObj = (StorloctransDetail)_WarehouseFacade.GetStorloctransdetail(transNo, fromStorageDetail.MCode); if (storloctransdetailObj == null) { return("转储单中没有对应的物料号"); } Location tLocation = (Location)facade.GetLocation(tLocationCode, 1); if (fromStorageDetail.StorageCode != tLocation.StorageCode) { return("原货位的库位必须与目标货位的库位一致!"); } if (toStorageDetail != null && toStorageDetail.StorageCode != fromStorageDetail.StorageCode) { return("目标箱号的库位必须原箱号的库位一样!"); } if (tcarton != fromCarton && toStorageDetail != null && toStorageDetail.LocationCode != tLocation.LocationCode) { return("目标箱号的货位必须与填写的目标货位一致!"); } if (toStorageDetail != null && toStorageDetail.DQMCode != fromStorageDetail.DQMCode) { return("目标箱号的物料必须与原箱号的物料一致!"); } if ((statusList == CartonType.CartonType_SplitCarton) && (tcarton == fromCarton)) { return("拆箱必须原箱号和目标箱号不同!"); } try { this.DataProvider.BeginTransaction(); InvInOutTrans trans = _WarehouseFacade.CreateNewInvInOutTrans(); trans.CartonNO = tcarton; trans.DqMCode = fromStorageDetail.DQMCode; trans.FacCode = fromStorageDetail.FacCode; trans.FromFacCode = fromStorageDetail.FacCode; trans.FromStorageCode = fromStorageDetail.StorageCode; trans.InvNO = " "; trans.InvType = " "; trans.LotNo = " "; trans.MaintainDate = dbDateTime.DBDate; trans.MaintainTime = dbDateTime.DBTime; trans.MaintainUser = userCode; trans.MCode = fromStorageDetail.MCode; trans.ProductionDate = fromStorageDetail.ProductionDate; trans.Qty = fromStorageDetail.StorageQty; trans.Serial = 0; trans.StorageAgeDate = fromStorageDetail.StorageAgeDate; trans.StorageCode = fromStorageDetail.StorageCode; trans.SupplierLotNo = fromStorageDetail.SupplierLotNo; trans.TransNO = transNo; trans.TransType = "IN"; trans.ProcessType = "LocationTrans"; trans.Unit = fromStorageDetail.Unit; _WarehouseFacade.AddInvInOutTrans(trans); #region【整箱】: if (statusList == CartonType.CartonType_AllCarton) { msgsn = "箱号:" + fromCarton; if (fromStorageDetail.FreezeQty > 0) { return("此箱号以被占用不能移动"); } if (_WarehouseFacade.GetStorageDetailSNPickBlockCount(fromCarton) > 0) { return("此箱号SN已被被占用不能移动"); } if (_WarehouseFacade.GetStorloctransdetailcarton(transNo, fromCarton, tcarton) != null) { return(transNo + "此单下已存在" + fromCarton + "移动到" + tcarton + ",请另行创建单据!"); } facade.DeleteStorageDetail(fromStorageDetail); toStorageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(tcarton); if (toStorageDetail == null) { toStorageDetail = new StorageDetail(); toStorageDetail.AvailableQty = 0; toStorageDetail.CartonNo = tcarton; toStorageDetail.CDate = FormatHelper.TODateInt(DateTime.Now); toStorageDetail.CTime = FormatHelper.TOTimeInt(DateTime.Now); toStorageDetail.CUser = userCode; toStorageDetail.DQMCode = fromStorageDetail.DQMCode; toStorageDetail.FacCode = fromStorageDetail.FacCode; toStorageDetail.FreezeQty = 0; toStorageDetail.LastStorageAgeDate = fromStorageDetail.LastStorageAgeDate; toStorageDetail.LocationCode = tLocationCode; toStorageDetail.Lotno = fromStorageDetail.Lotno; toStorageDetail.MaintainDate = FormatHelper.TODateInt(DateTime.Now); toStorageDetail.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); toStorageDetail.MaintainUser = userCode; toStorageDetail.MCode = fromStorageDetail.MCode; toStorageDetail.MDesc = fromStorageDetail.MDesc; toStorageDetail.ProductionDate = fromStorageDetail.ProductionDate; toStorageDetail.ReworkApplyUser = fromStorageDetail.ReworkApplyUser; toStorageDetail.StorageAgeDate = fromStorageDetail.StorageAgeDate; toStorageDetail.StorageCode = fromStorageDetail.StorageCode; toStorageDetail.StorageQty = 0; toStorageDetail.SupplierLotNo = fromStorageDetail.SupplierLotNo; toStorageDetail.Unit = fromStorageDetail.Unit; toStorageDetail.ValidStartDate = fromStorageDetail.ValidStartDate; facade.AddStorageDetail(toStorageDetail); } toStorageDetail.StorageQty += fromStorageDetail.StorageQty; toStorageDetail.AvailableQty += fromStorageDetail.AvailableQty; facade.UpdateStorageDetail(toStorageDetail); StorloctransDetail storloctransDetail = (StorloctransDetail)_WarehouseFacade.GetStorloctransdetail(transNo, fromStorageDetail.MCode); storloctransDetail.Qty += fromStorageDetail.AvailableQty; _WarehouseFacade.UpdateStorloctransdetail(storloctransDetail); #region 4, 向TBLStorLocTransDetailCarton插入一笔数据。 StorloctransDetailCarton newstorlocDetailCarton = new StorloctransDetailCarton(); newstorlocDetailCarton.Transno = transNo; //storlocDetailCarton.Transno = StorLocTransDetail.TransNo; newstorlocDetailCarton.MCode = fromStorageDetail.MCode; //MCODE:TBLStorLocTransDetail.MCODE newstorlocDetailCarton.DqmCode = fromStorageDetail.DQMCode; newstorlocDetailCarton.FacCode = "10Y2"; newstorlocDetailCarton.Qty = fromStorageDetail.StorageQty; //QTY: TBLStorageDetail. storageQTY newstorlocDetailCarton.LocationCode = tLocationCode; //LocationCode: TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找) newstorlocDetailCarton.Cartonno = tcarton; //CARTONNO:PDA页面的目标箱号 txtTLocationCartonEdit newstorlocDetailCarton.FromlocationCode = fromStorageDetail.LocationCode; //FromLocationCode:TBLStorageDetail.LocationCode newstorlocDetailCarton.Fromcartonno = fromStorageDetail.CartonNo; //FromCARTONNO:TBLStorageDetail. CARTONNO newstorlocDetailCarton.Lotno = fromStorageDetail.Lotno; //LotNo:TBLStorageDetail. LotNo newstorlocDetailCarton.CUser = userCode; // CUSER newstorlocDetailCarton.CDate = dbDateTime.DBDate; // CDATE newstorlocDetailCarton.CTime = dbDateTime.DBTime; // CTIME newstorlocDetailCarton.MaintainDate = dbDateTime.DBDate; // MDATE newstorlocDetailCarton.MaintainTime = dbDateTime.DBTime; // MTIME newstorlocDetailCarton.MaintainUser = userCode; _WarehouseFacade.AddStorloctransdetailcarton(newstorlocDetailCarton); #endregion //5, 如果原箱号在TBLStorageDetailSN有SN信息,将SN信息插入到TBLStorLocTransDetailSN表 object[] storageDetailSnlist = facade.GetStorageDetailSnbyCarton(fromCarton); if (storageDetailSnlist != null) { foreach (StorageDetailSN newStorageDetailSn in storageDetailSnlist) { #region add TBLStorageDetailSN StorloctransDetailSN newStorloctransDetailSn = new StorloctransDetailSN(); newStorloctransDetailSn.Sn = newStorageDetailSn.SN; //SN:TBLStorageDetailSN.SN newStorloctransDetailSn.Transno = transNo; // TBLStorLocTransDetail. TransNo newStorloctransDetailSn.Fromcartonno = fromCarton; //FromCARTONNO:TBLStorageDetail.LocationCode newStorloctransDetailSn.Cartonno = tcarton; //FormatHelper.CleanString(txtTLocationCodeEdit.Text);//CARTONNO:TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找) newStorloctransDetailSn.MaintainDate = dbDateTime.DBDate; // MDATE newStorloctransDetailSn.MaintainTime = dbDateTime.DBTime; // MTIME newStorloctransDetailSn.MaintainUser = userCode; _WarehouseFacade.AddStorloctransdetailsn(newStorloctransDetailSn); newStorageDetailSn.CartonNo = tcarton; newStorageDetailSn.MaintainDate = FormatHelper.TODateInt(DateTime.Now); newStorageDetailSn.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); newStorageDetailSn.MaintainUser = userCode; facade.UpdateStorageDetailSN(newStorageDetailSn); #endregion } } } #endregion #region【拆箱】: else if (statusList == CartonType.CartonType_SplitCarton) { Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(storageCarton.MCode); if (material != null) { //2单件管控IsInt if (material.MCONTROLTYPE == BOMItemControlType.ITEM_CONTROL_KEYPARTS) { #region 单件管控: msgsn = "SN:" + inputsn; if (string.IsNullOrEmpty(inputsn)) { msg = "此箱为单件管控,请输入SN。"; return(msg); } StorageDetailSN storageDetailSn = (StorageDetailSN)facade.GetStorageDetailSN(inputsn); if (storageDetailSn == null) { return("此SN不存在!"); } if (storageDetailSn.CartonNo != fromCarton) { return("原箱中不存在此SN!"); } decimal storageQTY = fromStorageDetail.StorageQty - fromStorageDetail.FreezeQty; if (storageQTY <= 0) { return("原箱号的库存数量不足:" + storageQTY); } if (toStorageDetail == null) { toStorageDetail = new StorageDetail(); toStorageDetail.AvailableQty = 0; toStorageDetail.CartonNo = tcarton; toStorageDetail.CDate = FormatHelper.TODateInt(DateTime.Now); toStorageDetail.CTime = FormatHelper.TOTimeInt(DateTime.Now); toStorageDetail.CUser = userCode; toStorageDetail.DQMCode = fromStorageDetail.DQMCode; toStorageDetail.FacCode = fromStorageDetail.FacCode; toStorageDetail.FreezeQty = 0; toStorageDetail.LastStorageAgeDate = fromStorageDetail.LastStorageAgeDate; toStorageDetail.LocationCode = tLocationCode; toStorageDetail.Lotno = fromStorageDetail.Lotno; toStorageDetail.MaintainDate = FormatHelper.TODateInt(DateTime.Now); toStorageDetail.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); toStorageDetail.MaintainUser = userCode; toStorageDetail.MCode = fromStorageDetail.MCode; toStorageDetail.MDesc = fromStorageDetail.MDesc; toStorageDetail.ProductionDate = fromStorageDetail.ProductionDate; toStorageDetail.ReworkApplyUser = fromStorageDetail.ReworkApplyUser; toStorageDetail.StorageAgeDate = fromStorageDetail.StorageAgeDate; toStorageDetail.StorageCode = fromStorageDetail.StorageCode; toStorageDetail.StorageQty = 0; toStorageDetail.SupplierLotNo = fromStorageDetail.SupplierLotNo; toStorageDetail.Unit = fromStorageDetail.Unit; toStorageDetail.ValidStartDate = fromStorageDetail.ValidStartDate; facade.AddStorageDetail(toStorageDetail); } #region add by sam 2016年4月27日 storageDetailSn.CartonNo = tcarton; facade.UpdateStorageDetailSN(storageDetailSn); fromStorageDetail.StorageQty -= 1; fromStorageDetail.AvailableQty -= 1; facade.UpdateStorageDetail(fromStorageDetail); toStorageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(tcarton); toStorageDetail.StorageQty += 1; toStorageDetail.AvailableQty += 1; facade.UpdateStorageDetail(toStorageDetail); #endregion StorloctransDetail storloctransDetail = (StorloctransDetail)_WarehouseFacade.GetStorloctransdetail(transNo, fromStorageDetail.MCode); storloctransDetail.Qty += fromStorageDetail.AvailableQty; _WarehouseFacade.UpdateStorloctransdetail(storloctransDetail); StorloctransDetailCarton storloctransDetailCarton = (StorloctransDetailCarton) _WarehouseFacade.GetStorloctransdetailcarton(transNo, fromCarton, tcarton); if (storloctransDetailCarton != null) {// 如果有: 更新TBLStorLocTransDetailCarton.QTY+ PDA页面填的数量,MDate,MTime,MUser。 storloctransDetailCarton.Qty += 1; storloctransDetailCarton.MaintainDate = dbDateTime.DBDate; storloctransDetailCarton.MaintainTime = dbDateTime.DBTime; storloctransDetailCarton.MaintainUser = userCode; _WarehouseFacade.UpdateStorloctransdetailcarton(storloctransDetailCarton); } else { #region 4, 向TBLStorLocTransDetailCarton插入一笔数据。 StorloctransDetailCarton newstorlocDetailCarton = new StorloctransDetailCarton(); newstorlocDetailCarton.Transno = transNo;// storloctransdetailObj.Transno; //storlocDetailCarton.Transno = StorLocTransDetail.TransNo; newstorlocDetailCarton.DqmCode = storloctransdetailObj.DqmCode; newstorlocDetailCarton.FacCode = "10Y2"; newstorlocDetailCarton.MCode = storloctransdetailObj.MCode; //MCODE:TBLStorLocTransDetail.MCODE newstorlocDetailCarton.Qty = 1; // //QTY: 1 newstorlocDetailCarton.LocationCode = tLocationCode; // FormatHelper.CleanString(txtTLocationCodeEdit.Text);//LocationCode: TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找) newstorlocDetailCarton.Cartonno = tcarton; // FormatHelper.CleanString(txtTLocationCartonEdit.Text);//CARTONNO:PDA页面的目标箱号 txtTLocationCartonEdit newstorlocDetailCarton.FromlocationCode = fromStorageDetail.LocationCode; //FromLocationCode:TBLStorageDetail.LocationCode newstorlocDetailCarton.Fromcartonno = fromCarton; // rageDetail.CartonNo; //FromCARTONNO:TBLStorageDetail. CARTONNO newstorlocDetailCarton.Lotno = fromStorageDetail.Lotno; //LotNo:TBLStorageDetail. LotNo newstorlocDetailCarton.CUser = userCode; // CUSER newstorlocDetailCarton.CDate = dbDateTime.DBDate; // CDATE newstorlocDetailCarton.CTime = dbDateTime.DBTime; // CTIME newstorlocDetailCarton.MaintainDate = dbDateTime.DBDate; // MDATE newstorlocDetailCarton.MaintainTime = dbDateTime.DBTime; // MTIME newstorlocDetailCarton.MaintainUser = userCode; _WarehouseFacade.AddStorloctransdetailcarton(newstorlocDetailCarton); #endregion //说明:表中没有的字段来自TBLStorageDetail中对应字段 //F 向表TBLStorLocTransDetailSN插入一条数据。 StorloctransDetailSN newStorloctransDetailSn = new StorloctransDetailSN(); newStorloctransDetailSn.Sn = inputsn; //SN:TBLStorageDetailSN.SN newStorloctransDetailSn.Transno = storloctransdetailObj.Transno; // TBLStorLocTransDetail. TransNo newStorloctransDetailSn.Fromcartonno = fromCarton; //TBLStorageDetail.LocationCode newStorloctransDetailSn.Cartonno = tcarton; // FormatHelper.CleanString(txtTLocationCodeEdit.Text);//CARTONNO:TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找) newStorloctransDetailSn.MaintainDate = dbDateTime.DBDate; // MDATE newStorloctransDetailSn.MaintainTime = dbDateTime.DBTime; // MTIME newStorloctransDetailSn.MaintainUser = userCode; _WarehouseFacade.AddStorloctransdetailsn(newStorloctransDetailSn); } #endregion } else { #region 和非单件管控 //B 检查TBLStorageDetail. AvailableQTY>PDA页面填的数量。如果否,提示:输入的数量大于库存可用数量。 #region Check 数量 int qty; if (!string.IsNullOrEmpty(inputqty)) { try { qty = Int32.Parse(inputqty); } catch (Exception ex) { msg = "数量只能输入大于0的数字"; return(msg); } if (qty <= 0) { msg = "数量只能输入大于0的数字"; return(msg); } } else { msg = "数量不能为空"; return(msg); } #endregion decimal stroageQTY = fromStorageDetail.StorageQty - fromStorageDetail.FreezeQty; if (stroageQTY < qty) { msg = "输入的数量大于库存可用数量"; return(msg); } fromStorageDetail.AvailableQty -= qty; fromStorageDetail.StorageQty -= qty; facade.UpdateStorageDetail(fromStorageDetail); if (toStorageDetail == null) { toStorageDetail = new StorageDetail(); toStorageDetail.AvailableQty = 0; toStorageDetail.CartonNo = tcarton; toStorageDetail.CDate = FormatHelper.TODateInt(DateTime.Now); toStorageDetail.CTime = FormatHelper.TOTimeInt(DateTime.Now); toStorageDetail.CUser = userCode; toStorageDetail.DQMCode = fromStorageDetail.DQMCode; toStorageDetail.FacCode = fromStorageDetail.FacCode; toStorageDetail.FreezeQty = 0; toStorageDetail.LastStorageAgeDate = fromStorageDetail.LastStorageAgeDate; toStorageDetail.LocationCode = tLocationCode; toStorageDetail.Lotno = fromStorageDetail.Lotno; toStorageDetail.MaintainDate = FormatHelper.TODateInt(DateTime.Now); toStorageDetail.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); toStorageDetail.MaintainUser = userCode; toStorageDetail.MCode = fromStorageDetail.MCode; toStorageDetail.MDesc = fromStorageDetail.MDesc; toStorageDetail.ProductionDate = fromStorageDetail.ProductionDate; toStorageDetail.ReworkApplyUser = fromStorageDetail.ReworkApplyUser; toStorageDetail.StorageAgeDate = fromStorageDetail.StorageAgeDate; toStorageDetail.StorageCode = fromStorageDetail.StorageCode; toStorageDetail.StorageQty = 0; toStorageDetail.SupplierLotNo = fromStorageDetail.SupplierLotNo; toStorageDetail.Unit = fromStorageDetail.Unit; toStorageDetail.ValidStartDate = fromStorageDetail.ValidStartDate; facade.AddStorageDetail(toStorageDetail); } toStorageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(tcarton); toStorageDetail.StorageQty += qty; toStorageDetail.AvailableQty += qty; facade.UpdateStorageDetail(toStorageDetail); StorloctransDetailCarton storloctransDetailCarton = (StorloctransDetailCarton) _WarehouseFacade.GetStorloctransdetailcarton(transNo, fromCarton, tcarton); if (storloctransDetailCarton != null) { // 如果有: 更新TBLStorLocTransDetailCarton.QTY+ PDA页面填的数量,MDate,MTime,MUser。 storloctransDetailCarton.Qty += qty; // int.Parse(txtNumEdit.Text); storloctransDetailCarton.MaintainDate = dbDateTime.DBDate; storloctransDetailCarton.MaintainTime = dbDateTime.DBTime; storloctransDetailCarton.MaintainUser = userCode; _WarehouseFacade.UpdateStorloctransdetailcarton(storloctransDetailCarton); } else { #region 如果没有:插入一条数据 向TBLStorLocTransDetailCarton插入一笔数据。 StorloctransDetailCarton newstorlocDetailCarton = new StorloctransDetailCarton(); newstorlocDetailCarton.Transno = transNo; // storloctransdetailObj.Transno; newstorlocDetailCarton.DqmCode = fromStorageDetail.DQMCode; // storloctransdetailObj.DqmCode; newstorlocDetailCarton.FacCode = fromStorageDetail.FacCode; newstorlocDetailCarton.MCode = storageCarton.MCode; // storloctransdetailObj.MCode;//MCODE:TBLStorLocTransDetail.MCODE newstorlocDetailCarton.Qty = qty; //QTY: 1 newstorlocDetailCarton.LocationCode = tLocationCode; //FormatHelper.CleanString(txtTLocationCodeEdit.Text);//LocationCode: TBLLOCATION.LOCATIONCODE(根据PDA页面的目标货位找) newstorlocDetailCarton.Cartonno = tcarton; // FormatHelper.CleanString(txtTLocationCartonEdit.Text);//CARTONNO:PDA页面的目标箱号 txtTLocationCartonEdit newstorlocDetailCarton.FromlocationCode = fromStorageDetail.LocationCode; //FromLocationCode:TBLStorageDetail.LocationCode newstorlocDetailCarton.Fromcartonno = fromCarton; // storageDetail.CartonNo; //FromCARTONNO:TBLStorageDetail. CARTONNO newstorlocDetailCarton.Lotno = storageCarton.Lotno; //LotNo:TBLStorageDetail. LotNo newstorlocDetailCarton.CUser = userCode; // CUSER newstorlocDetailCarton.CDate = dbDateTime.DBDate; // CDATE newstorlocDetailCarton.CTime = dbDateTime.DBTime; // CTIME newstorlocDetailCarton.MaintainDate = dbDateTime.DBDate; // MDATE newstorlocDetailCarton.MaintainTime = dbDateTime.DBTime; // MTIME newstorlocDetailCarton.MaintainUser = userCode; _WarehouseFacade.AddStorloctransdetailcarton(newstorlocDetailCarton); #endregion } #endregion } } } #endregion fromStorageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(fromCarton); if (fromStorageDetail != null && fromStorageDetail.StorageQty == 0) { _WarehouseFacade.DeleteStorageDetail(fromStorageDetail); } string documentno = CreateAutoDocmentsNo(); SaveDocmentsNo(documentno, userCode); this.DataProvider.CommitTransaction(); msg = "提交成功"; return(msg); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); msg = ex.Message; return(msg); } }
protected void cmdAdd_ServerClick(object sender, System.EventArgs e) { if (_opBOMFacade == null) { _opBOMFacade = new FacadeFactory(base.DataProvider).CreateOPBOMFacade(); } if (_itemFacade == null) { _itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade(); } ArrayList array = this.GetNoRepeatSelectObjs(this.gridHelper.GetCheckedRows()); if (array.Count > 0) { ArrayList sboms = new ArrayList(); Hashtable notInOPBOMHT = this.GetNotInOPBOMHashtalbe(); string returnMsg = string.Empty; foreach (GridRecord row in array) { object obj = this.GetEditObject(row); if (obj != null) { if (notInOPBOMHT.Contains(((SBOM)obj).SBOMItemCode))//只有不在opbom中的子阶料才可以添加到列表中 { sboms.Add((SBOM)obj); } } } if (sboms.Count > 0) { ItemRoute2OP itemRoute2Operation = (ItemRoute2OP)_itemFacade.GetItemRoute2Op(OPID, GlobalVariables.CurrentOrganizations.First().OrganizationID); _opBOMFacade.AssignBOMItemToOperation(OPBOMCode, OPBOMVersion, itemRoute2Operation, (SBOM[])sboms.ToArray(typeof(SBOM)), this.Actiontype); //Laws Lu,2006/09/01 /*1,目前工序BOM建立逻辑不变,增加生效检查功能和失效功能, * 初始建立的工序BOM资料处于失效状态,通过生效检查后处于生效状态, * 此时不允许修改,只有失效状态的工序BOM才可以修改。 * 生效检查逻辑包括:完整的工序BOM包含的子阶物料(替代料)必须包含某工单所有的已发料物料代码, * 比如,工单发料资料中包含5种物料,则工序BOM中的子阶物料必须也有这五种物料, * 且首选料不能有这五种物料之外的其他物料。具体的工单由用户在界面指定。 * 举例如下:工单发料资料中有A,B,C,D四种物料*/ DataProvider.BeginTransaction(); try { MOFacade moFac = (new FacadeFactory(DataProvider)).CreateMOFacade(); object objOPBOM = moFac.GetOPBOM(itemRoute2Operation.ItemCode, OPBOMCode, OPBOMVersion, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (objOPBOM != null) { OPBOM opBOM = objOPBOM as OPBOM; opBOM.Avialable = 0; moFac.UpdateOPBOM(opBOM); } // Added by Icyer 2005/08/16 // 同时将物料加入到物料主档中 BenQGuru.eMES.Material.WarehouseFacade wf = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider); wf.AddWarehouseItem((SBOM[])sboms.ToArray(typeof(SBOM))); DataProvider.CommitTransaction(); //this.cmdReturn_ServerClick(sender,e); // Added end } catch (Exception ex) { Log.Error(ex.Message); DataProvider.RollbackTransaction(); throw ex; } finally { ((SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); } foreach (SBOM somobject in (SBOM[])sboms.ToArray(typeof(SBOM))) { ItemFacade itemFacade = new ItemFacade(this.DataProvider); Domain.MOModel.Material MaterialObject = (Domain.MOModel.Material)itemFacade.GetMaterial(somobject.SBOMItemCode.Trim().ToUpper(), GlobalVariables.CurrentOrganizations.First().OrganizationID); if (MaterialObject != null) { if (MaterialObject.MaterialCheckType.IndexOf(OPBOMDetailCheckType.CHECK_LINKBARCODE) < 0) { returnMsg += "$ITEM_NOT_LINKBARCODE:" + somobject.SBOMItemCode.Trim().ToUpper() + "\n "; } } } } //if (addItemMessage.Trim()!=string.Empty && addItemMessage.Trim().Length>0) //{ // WebInfoPublish.Publish(this, addItemMessage, this.languageComponent1); //} this.RequestData(); this.Return(sender, e, returnMsg); } }
private string autoCreateASNFromCheckoutInfo(string invNo, Pick pick) { try { InvoicesDetail invD = (InvoicesDetail)_InventoryFacade.GetInvoicesDetail(invNo); CARTONINVOICES[] cartos = _warehouseFacade.GetGrossAndWeight(pick.PickNo); string stno = CreateStNO(); Asn asn = new Asn(); asn.Stno = stno; asn.StType = "UB"; asn.CDate = FormatHelper.TODateInt(DateTime.Now); asn.CTime = FormatHelper.TOTimeInt(DateTime.Now); asn.CUser = GetUserCode(); asn.Status = "Release"; asn.Invno = invNo; asn.FacCode = pick.FacCode; if (cartos.Length > 0) { asn.Gross_weight = (decimal)cartos[0].GROSS_WEIGHT; asn.Volume = cartos[0].VOLUME; } asn.StorageCode = invD.StorageCode ?? " "; asn.MaintainUser = GetUserCode(); asn.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); asn.MaintainDate = FormatHelper.TODateInt(DateTime.Now); CartonInvDetailMaterial[] cartonMs = _warehouseFacade.GetCartonInvDetailMaterial(pick.PickNo); MOModel.ItemFacade _itemfacade = new BenQGuru.eMES.MOModel.ItemFacade(this.DataProvider); int i = 1; this.DataProvider.BeginTransaction(); foreach (CartonInvDetailMaterial m in cartonMs) { object materobj = _itemfacade.GetMaterial(m.MCODE); Domain.MOModel.Material mater = materobj as Domain.MOModel.Material; if (materobj == null) { this.DataProvider.RollbackTransaction(); throw new Exception("物料表没有物料:" + m.MCODE); } string custMCode = _warehouseFacade.GetCustMCodeForUB(pick.PickNo, m.DQMCODE); if (mater.MCONTROLTYPE == SAP_CONTROLTYPE.SAP_ITEM_CONTROL_KEYPARTS) { ASNDetail asnd = new ASNDetail(); asnd.ActQty = 0; //asnd.CartonNo = " "; asnd.DQMCode = m.DQMCODE; asnd.Qty = (int)m.QTY; asnd.StLine = i.ToString(); asnd.CustMCode = custMCode; asnd.MCode = m.MCODE; asnd.Status = "Release"; asnd.StNo = stno; asnd.MDesc = mater.MchshortDesc; asnd.Unit = m.UNIT; asnd.CDate = FormatHelper.TODateInt(DateTime.Now); asnd.CTime = FormatHelper.TOTimeInt(DateTime.Now); asnd.CUser = GetUserCode(); asnd.MaintainDate = FormatHelper.TODateInt(DateTime.Now); asnd.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); asnd.MaintainUser = GetUserCode(); asnd.LotNo = " "; CARTONINVDETAILSN[] sns = _warehouseFacade.GetCartonInvDetailSn(m.CARTONNO, pick.PickNo); List <string> snList = new List <string>(); if (sns.Length > 0) { foreach (CARTONINVDETAILSN sn in sns) { snList.Add(sn.SN); } Asndetail detail = _warehouseFacade.GetFirstCheckInAsnDetail(snList); if (detail != null) { asnd.ProductionDate = detail.Production_Date; asnd.SupplierLotNo = detail.Supplier_lotno; asnd.LotNo = detail.Lotno; asnd.StorageAgeDate = detail.StorageageDate; } } DBDateTime dbTime = FormatHelper.GetNowDBDateTime(this.DataProvider); Asndetailitem detailitem = _warehouseFacade.CreateNewAsndetailitem(); detailitem.CDate = dbTime.DBDate; detailitem.CTime = dbTime.DBTime; detailitem.CUser = this.GetUserCode(); detailitem.MaintainDate = dbTime.DBDate; detailitem.MaintainTime = dbTime.DBTime; detailitem.MaintainUser = this.GetUserCode(); detailitem.Stline = i.ToString(); detailitem.Stno = asn.Stno; detailitem.MCode = asnd.MCode; detailitem.DqmCode = asnd.DQMCode; //查找对应的SAP单 object[] qtyobjs = _warehouseFacade.GetSAPNOandLinebyMCODE(asn.Invno, asnd.MCode, asnd.DQMCode); if (qtyobjs == null) { this.DataProvider.RollbackTransaction(); throw new Exception("入库需求" + asn.Invno + " 没有相关物料" + asnd.MCode + "," + asnd.DQMCode + "或者此行已被取消!"); } decimal sub = asnd.Qty; for (int k = 0; k < qtyobjs.Length; k++) { InvoicesDetail invdetail = qtyobjs[k] as InvoicesDetail; decimal subNeed = 0; object findNeedQTY_old = _warehouseFacade.GetNeedImportQtyOLD(invdetail.InvNo, invdetail.InvLine, asnd.StNo); //找这个invoice行已经导入了多少,和判退多少 Asndetailitem subItemOld = findNeedQTY_old as Asndetailitem; object findNeedQTY_now = _warehouseFacade.GetNeedImportQtyNow(invdetail.InvNo, invdetail.InvLine, asnd.StNo); //找这个invoice行已经导入了多少,和判退多少 Asndetailitem subItemNow = findNeedQTY_now as Asndetailitem; subNeed = invdetail.PlanQty - subItemOld.Qty + (subItemOld.Qty - subItemOld.ReceiveQty) + (subItemOld.ReceiveQty - subItemOld.QcpassQty); subNeed = subNeed - subItemNow.Qty; if (subNeed == 0) { continue; } //如果箱数量大于需求数量差---进行拆分 if (sub > subNeed) { sub = sub - subNeed; // sub是剩余的 detailitem.Qty = subNeed; detailitem.Invline = invdetail.InvLine.ToString(); detailitem.Invno = invdetail.InvNo; detailitem.ActQty = detailitem.Qty; detailitem.QcpassQty = detailitem.Qty; detailitem.ReceiveQty = detailitem.Qty; _warehouseFacade.AddAsndetailitem(detailitem); } //如果箱单数量小于等于需求数量差--直接填入 else { detailitem.Qty = sub; detailitem.Invline = invdetail.InvLine.ToString(); detailitem.Invno = invdetail.InvNo; detailitem.ActQty = detailitem.Qty; detailitem.QcpassQty = detailitem.Qty; detailitem.ReceiveQty = detailitem.Qty; _warehouseFacade.AddAsndetailitem(detailitem); sub = 0; } if (sub == 0) { break; } } //如果sub>0,说明导入数量过多,报错 if (sub > 0) { this.DataProvider.RollbackTransaction(); throw new Exception("箱单导入数量与需求数量不符!"); } foreach (CARTONINVDETAILSN sn in sns) { Asndetailsn asnSN = new Asndetailsn(); asnSN.CDate = FormatHelper.TODateInt(DateTime.Now); asnSN.CTime = FormatHelper.TOTimeInt(DateTime.Now); asnSN.CUser = GetUserCode(); asnSN.MaintainDate = FormatHelper.TODateInt(DateTime.Now); asnSN.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); asnSN.MaintainUser = GetUserCode(); asnSN.Sn = sn.SN; asnSN.Stline = i.ToString(); asnSN.Stno = stno; _warehouseFacade.AddAsndetailsn(asnSN); } _InventoryFacade.AddASNDetail(asnd); } else if (mater.MCONTROLTYPE == SAP_CONTROLTYPE.SAP_ITEM_CONTROL_LOT || mater.MCONTROLTYPE == SAP_CONTROLTYPE.SAP_ITEM_CONTROL_NOCONTROL) { ASNDetail asnd = new ASNDetail(); asnd.ActQty = 0; asnd.CustMCode = custMCode; asnd.DQMCode = m.DQMCODE; asnd.Qty = (int)m.QTY; asnd.StLine = i.ToString(); asnd.MCode = m.MCODE; asnd.StNo = stno; asnd.Status = "Release"; asnd.MDesc = mater.MchshortDesc; asnd.Unit = m.UNIT; asnd.CDate = FormatHelper.TODateInt(DateTime.Now); asnd.CTime = FormatHelper.TOTimeInt(DateTime.Now); asnd.CUser = GetUserCode(); asnd.MaintainDate = FormatHelper.TODateInt(DateTime.Now); asnd.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); asnd.MaintainUser = GetUserCode(); asnd.LotNo = " "; Pickdetailmaterial pickMaterial = (Pickdetailmaterial)_warehouseFacade.GetLotNOInformationFromDQMCODE(m.DQMCODE, pick.PickNo); if (pickMaterial != null) { asnd.ProductionDate = pickMaterial.Production_Date; asnd.SupplierLotNo = pickMaterial.Supplier_lotno; asnd.LotNo = pickMaterial.Lotno; asnd.StorageAgeDate = pickMaterial.StorageageDate; } else { throw new Exception(pick.PickNo + "没有找到检料信息!"); } _InventoryFacade.AddASNDetail(asnd); DBDateTime dbTime = FormatHelper.GetNowDBDateTime(this.DataProvider); Asndetailitem detailitem = _warehouseFacade.CreateNewAsndetailitem(); detailitem.CDate = dbTime.DBDate; detailitem.CTime = dbTime.DBTime; detailitem.CUser = this.GetUserCode(); detailitem.MaintainDate = dbTime.DBDate; detailitem.MaintainTime = dbTime.DBTime; detailitem.MaintainUser = this.GetUserCode(); detailitem.Stline = i.ToString(); detailitem.Stno = asn.Stno; detailitem.MCode = asnd.MCode; detailitem.DqmCode = asnd.DQMCode; //查找对应的SAP单 object[] qtyobjs = _warehouseFacade.GetSAPNOandLinebyMCODE(asn.Invno, asnd.MCode, asnd.DQMCode); if (qtyobjs == null) { this.DataProvider.RollbackTransaction(); throw new Exception("箱单导入数量与需求数量不符!"); } decimal sub = asnd.Qty; for (int k = 0; k < qtyobjs.Length; k++) { InvoicesDetail invdetail = qtyobjs[k] as InvoicesDetail; decimal subNeed = 0; object findNeedQTY_old = _warehouseFacade.GetNeedImportQtyOLD(invdetail.InvNo, invdetail.InvLine, asnd.StNo); //找这个invoice行已经导入了多少,和判退多少 Asndetailitem subItemOld = findNeedQTY_old as Asndetailitem; object findNeedQTY_now = _warehouseFacade.GetNeedImportQtyNow(invdetail.InvNo, invdetail.InvLine, asnd.StNo); //找这个invoice行已经导入了多少,和判退多少 Asndetailitem subItemNow = findNeedQTY_now as Asndetailitem; subNeed = invdetail.PlanQty - subItemOld.Qty + (subItemOld.Qty - subItemOld.ReceiveQty) + (subItemOld.ReceiveQty - subItemOld.QcpassQty); subNeed = subNeed - subItemNow.Qty; if (subNeed == 0) { continue; } //如果箱数量大于需求数量差---进行拆分 if (sub > subNeed) { sub = sub - subNeed; // sub是剩余的 detailitem.Qty = subNeed; detailitem.Invline = invdetail.InvLine.ToString(); detailitem.Invno = invdetail.InvNo; detailitem.ActQty = detailitem.Qty; detailitem.QcpassQty = detailitem.Qty; detailitem.ReceiveQty = detailitem.Qty; _warehouseFacade.AddAsndetailitem(detailitem); } //如果箱单数量小于等于需求数量差--直接填入 else { detailitem.Qty = sub; detailitem.Invline = invdetail.InvLine.ToString(); detailitem.Invno = invdetail.InvNo; detailitem.ActQty = detailitem.Qty; detailitem.QcpassQty = detailitem.Qty; detailitem.ReceiveQty = detailitem.Qty; _warehouseFacade.AddAsndetailitem(detailitem); sub = 0; } if (sub == 0) { break; } } //如果sub>0,说明导入数量过多,报错 if (sub > 0) { this.DataProvider.RollbackTransaction(); throw new Exception("箱单导入数量与需求数量不符!"); } } i++; } _warehouseFacade.AddAsn(asn); WarehouseFacade facade = new WarehouseFacade(base.DataProvider); #region 在invinouttrans表中增加一条数据 //ASN asn = (ASN)domainObject; DBDateTime dbTime1 = FormatHelper.GetNowDBDateTime(this.DataProvider); InvInOutTrans trans = facade.CreateNewInvInOutTrans(); trans.CartonNO = string.Empty; trans.DqMCode = string.Empty; trans.FacCode = asn.FacCode; trans.FromFacCode = asn.FromfacCode; trans.FromStorageCode = asn.FromstorageCode; trans.InvNO = asn.Invno; trans.InvType = asn.StType; trans.LotNo = string.Empty; trans.MaintainDate = dbTime1.DBDate; trans.MaintainTime = dbTime1.DBTime; trans.MaintainUser = this.GetUserCode(); trans.MCode = string.Empty; trans.ProductionDate = 0; trans.Qty = 0; trans.Serial = 0; trans.StorageAgeDate = 0; trans.StorageCode = asn.StorageCode; trans.SupplierLotNo = string.Empty; trans.TransNO = asn.Stno; trans.TransType = "IN"; trans.Unit = string.Empty; trans.ProcessType = "UBCreateASN"; facade.AddInvInOutTrans(trans); #endregion this.DataProvider.CommitTransaction(); return(stno); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); throw ex; } }
//新增 protected override void AddDomainObject(object domainObject) { if (_InventoryFacade == null) { _InventoryFacade = new InventoryFacade(base.DataProvider); } ItemFacade itemFacade = new ItemFacade(this.DataProvider); string dQMCode = FormatHelper.CleanString(this.txtMaterialNO.Text); Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterialByDQMCode(dQMCode); Domain.MOModel.Material newMaterial = null; DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); try { this.DataProvider.BeginTransaction(); //如果该物料编码不存在物料主表,新增一笔数据 if (material == null) { newMaterial = new Domain.MOModel.Material(); newMaterial.MCode = FormatHelper.CleanString(this.txtMaterialNO.Text, 40); newMaterial.DqmCode = FormatHelper.CleanString(this.txtMaterialNO.Text, 40); newMaterial.MspecialDesc = FormatHelper.CleanString(this.txtSpecialDescEdit.Text, 200); newMaterial.Muom = FormatHelper.CleanString(this.txtUnitEdit.Text, 40); newMaterial.MType = "itemtype_finishedproduct"; newMaterial.Sourceflag = "MES"; newMaterial.CUser = this.GetUserCode(); newMaterial.CDate = dbDateTime.DBDate; newMaterial.CTime = dbDateTime.DBTime; newMaterial.MaintainUser = this.GetUserCode(); } if (newMaterial != null) { itemFacade.AddMaterial(newMaterial); } //同时更新库存 SpecStorageInfo specStorageInfo = (SpecStorageInfo)_InventoryFacade.GetSpecStorageInfo(((SpecInOut)domainObject).StorageCode, ((SpecInOut)domainObject).MCode, ((SpecInOut)domainObject).LocationCode); if (specStorageInfo != null) { specStorageInfo.StorageQty = specStorageInfo.StorageQty + Convert.ToInt32(this.txtQTY.Text.Trim()); this._InventoryFacade.UpdateSpecStorageInfo(specStorageInfo); } else { specStorageInfo = this._InventoryFacade.CreateNewSpecStorageInfo(); specStorageInfo.MCode = ((SpecInOut)domainObject).MCode; specStorageInfo.DQMCode = ((SpecInOut)domainObject).DQMCode; specStorageInfo.Muom = ((SpecInOut)domainObject).Muom; specStorageInfo.StorageCode = ((SpecInOut)domainObject).StorageCode; specStorageInfo.LocationCode = ((SpecInOut)domainObject).LocationCode; specStorageInfo.StorageQty = ((SpecInOut)domainObject).Qty; specStorageInfo.CUser = this.GetUserCode(); specStorageInfo.CDate = dbDateTime.DBDate; specStorageInfo.CTime = dbDateTime.DBTime; specStorageInfo.MaintainUser = this.GetUserCode(); this._InventoryFacade.AddSpecStorageInfo(specStorageInfo); } this._InventoryFacade.AddSpecInOut((SpecInOut)domainObject); this.DataProvider.CommitTransaction(); } catch (Exception ex) { WebInfoPublish.Publish(this, "新增失败:" + ex.Message, this.languageComponent1); this.DataProvider.RollbackTransaction(); } }
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 Messages DropLoadedParts(string rcard) { Messages msg = new Messages(); ActionOnLineHelper onLine = new ActionOnLineHelper(DataProvider); MaterialFacade materialFacade = new MaterialFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); TSFacade tsFacade = new TSFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty); ProductInfo product = GetProduct(sourceRCard); if (product == null || product.LastSimulation == null) { msg.Add(new UserControl.Message(MessageType.Error, "$NoSimulation")); return(msg); } // Marked By HI1/Venus.Feng on 20081013 for Hisense Version : GOOD can do drop /* * if (product.LastSimulation.ProductStatus != ProductStatus.NG) * { * msg.Add(new UserControl.Message(MessageType.Error, "$DropMaterial_Need_NG")); * return msg; * } */ // End Marked msg.Add(new UserControl.Message(rcard)); //获取所有需要拆解或者替换的Parts ArrayList partsToUnload = new ArrayList(); for (int i = 0; i < this.ultraGridLoadedPart.Rows.Count; i++) { if (ultraGridLoadedPart.Rows[i].Cells[0].Text.ToLower() == "true") { InnoObject innoObject = new InnoObject(); innoObject.LineIndex = i; innoObject.MCard = ultraGridLoadedPart.Rows[i].Cells["PackedNo"].Text; innoObject.MCardType = ultraGridLoadedPart.Rows[i].Cells["MCardType"].Text; innoObject.ItemIndex = partsToUnload.Count + 1; innoObject.MItemCode = ultraGridLoadedPart.Rows[i].Cells["ItemCode"].Text; innoObject.MOCode = ultraGridLoadedPart.Rows[i].Cells["MOCode"].Text; innoObject.Qty = 1; innoObject.NewBarcode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(ultraGridLoadedPart.Rows[i].Cells["NewBarcode"].Text.Trim())); partsToUnload.Add(innoObject); } } //对于需要替换的Parts,需要做类似上料中的解析和检查 for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (innoObject.NewBarcode.Trim().Length > 0) { //抓取物料的设定 Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(innoObject.MItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (material == null) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_NotFound")); return(msg); } string barcode = innoObject.NewBarcode.Trim(); //模拟一个OPBOMDetail OPBOMDetail detailTemp = new OPBOMDetail(); detailTemp.OPBOMItemControlType = material.MaterialControlType; detailTemp.OPBOMParseType = material.MaterialParseType; detailTemp.OPBOMCheckType = material.MaterialCheckType; detailTemp.CheckStatus = material.CheckStatus; detailTemp.SerialNoLength = material.SerialNoLength; detailTemp.NeedVendor = material.NeedVendor; detailTemp.OPBOMSourceItemCode = innoObject.MItemCode; detailTemp.OPBOMItemCode = innoObject.MItemCode; detailTemp.OPBOMItemQty = 1; MINNO newMINNO = new MINNO(); newMINNO.MOCode = innoObject.MOCode.Trim(); newMINNO.MItemCode = material.MaterialCode.Trim(); Messages collectMessage = dataCollectFacade.GetMINNOByBarcode(detailTemp, barcode, newMINNO.MOCode, null, false, false, out newMINNO); if (collectMessage.IsSuccess()) { innoObject.NewLotNo = newMINNO.LotNO; innoObject.NewPCBA = newMINNO.PCBA; innoObject.NewBIOS = newMINNO.BIOS; innoObject.NewVersion = newMINNO.Version; innoObject.NewVendorItemCode = newMINNO.VendorItemCode; innoObject.NewVendorCode = newMINNO.VendorCode; innoObject.NewDateCode = newMINNO.DateCode; } else { msg.AddMessages(collectMessage); return(msg); } } } try { this.DataProvider.BeginTransaction(); //更新试流单 //下料中处理tbltry,tbltry2rcard for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; TryEventArgs tryEventArgs = new TryEventArgs( ActionType.DataCollectAction_TryNew, ApplicationService.Current().UserCode, product.LastSimulation.OPCode, ApplicationService.Current().ResourceCode, product.LastSimulation.ItemCode, sourceRCard, innoObject.MItemCode, innoObject.MCard, string.Empty, false, false); msg.AddMessages(onLine.ActionWithTransaction(tryEventArgs)); if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } } //更新试流单 //上料中处理tbltry,tbltry2rcard for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (innoObject.NewBarcode.Trim().Length > 0) { TryEventArgs tryEventArgs = new TryEventArgs( ActionType.DataCollectAction_TryNew, ApplicationService.Current().UserCode, product.LastSimulation.OPCode, ApplicationService.Current().ResourceCode, product.LastSimulation.ItemCode, sourceRCard, innoObject.MItemCode, innoObject.NewBarcode, string.Empty, true, true); msg.AddMessages(onLine.ActionWithTransaction(tryEventArgs)); if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } } } //检查新上料是否在TS中而不可用 for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (innoObject.NewBarcode.Trim().Length > 0) { if (!tsFacade.RunningCardCanBeClollected(innoObject.NewBarcode.Trim(), CardType.CardType_Part)) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTSOrScrapped $SERIAL_NO=" + innoObject.NewBarcode.Trim())); DataProvider.RollbackTransaction(); return(msg); } } } //拆解或者替换处理tblonwipitem,tblsimulationreport DropMaterialEventArgs dropMaterialEventArgs = new DropMaterialEventArgs(ActionType.DataCollectAction_DropMaterial, product.LastSimulation.RunningCard, ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, product); dropMaterialEventArgs.OnwipItems = partsToUnload.ToArray(); msg.AddMessages(onLine.ActionWithTransaction(dropMaterialEventArgs)); if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } //针对拆解下的物料,做TS相关的动作 for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (_TSList[innoObject.LineIndex] != null) { if (_TSErrorCodeList[innoObject.LineIndex] == null) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Select_ErrorCode")); DataProvider.RollbackTransaction(); return(msg); } Domain.TS.TS oldTS = (Domain.TS.TS)tsFacade.QueryLastTSByRunningCard(innoObject.MCard); if (oldTS != null) { if (oldTS.TSStatus == TSStatus.TSStatus_New || oldTS.TSStatus == TSStatus.TSStatus_Confirm || oldTS.TSStatus == TSStatus.TSStatus_TS) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTS")); DataProvider.RollbackTransaction(); return(msg); } else if (oldTS.TSStatus != TSStatus.TSStatus_Reflow && oldTS.TSStatus != TSStatus.TSStatus_Split && oldTS.TSStatus != TSStatus.TSStatus_Complete && oldTS.TSStatus != TSStatus.TSStatus_Scrap) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_WrongTSStatus")); DataProvider.RollbackTransaction(); return(msg); } } Domain.TS.TS newTS = (Domain.TS.TS)_TSList[innoObject.LineIndex]; tsFacade.AddTS(newTS); foreach (TSErrorCode tsErrorCode in (TSErrorCode[])_TSErrorCodeList[innoObject.LineIndex]) { tsErrorCode.RunningCard = newTS.RunningCard; tsErrorCode.RunningCardSequence = newTS.RunningCardSequence; tsErrorCode.ItemCode = newTS.ItemCode; tsErrorCode.ModelCode = newTS.ModelCode; tsErrorCode.MOCode = newTS.MOCode; tsErrorCode.MOSeq = newTS.MOSeq; tsErrorCode.MaintainUser = newTS.MaintainUser; tsErrorCode.MaintainDate = newTS.MaintainDate; tsErrorCode.MaintainTime = newTS.MaintainTime; tsFacade.AddTSErrorCode(tsErrorCode); } } } if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } if (msg.IsSuccess()) { DataProvider.CommitTransaction(); } else { DataProvider.RollbackTransaction(); } } catch (Exception e) { this.DataProvider.RollbackTransaction(); msg.Add(new UserControl.Message(e)); } return(msg); }
private void edtItemCode_TxtboxKeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { if (this.edtMoCode.Value.Trim() == string.Empty) { ApplicationRun.GetInfoForm().AddEx("$CS_CMPleaseInputMO"); this.edtMoCode.TextFocus(true, true); return; } if (this.edtCarton.Value.Trim() == string.Empty) { ApplicationRun.GetInfoForm().AddEx("$CS_PLEASE_INPUT_CARTONNO"); this.edtCarton.TextFocus(true, true); return; } if (ultraGridDetail.Rows.Count <= 0) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_GRID_NO_RECORD")); this.edtItemCode.TextFocus(true, true); return; } if (!this.CheckGrid()) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_GRID_SELECT_ONE_RECORD")); this.edtItemCode.TextFocus(false, true); return; } Package.PackageFacade packageFacade = new BenQGuru.eMES.Package.PackageFacade(this.DataProvider); DataCollect.DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); SKDCartonDetail skdCartonDetail = (SKDCartonDetail)packageFacade.GetSKDCartonDetail(this.edtMoCode.Value.Trim().ToUpper(), this.edtItemCode.Value.Trim().ToUpper()); if (skdCartonDetail != null) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Carton_Have_In_This_moCode")); this.edtItemCode.TextFocus(true, true); return; } //下面做物料的检查 Messages msg = new Messages(); string materialCode = string.Empty; for (int i = 0; i < ultraGridDetail.Rows.Count; i++) { if (ultraGridDetail.Rows[i].Cells[0].Value.ToString().ToLower() == "true") { materialCode = ultraGridDetail.Rows[i].Cells[1].Value.ToString(); _itemCode = materialCode; break; } } Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(materialCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (material == null) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Material_NotFound")); this.edtItemCode.TextFocus(true, true); return; } OPBOMDetail detailTemp = new OPBOMDetail(); //模拟一个OPBOMDetail detailTemp.OPBOMItemControlType = material.MaterialControlType; detailTemp.OPBOMParseType = material.MaterialParseType; detailTemp.OPBOMCheckType = material.MaterialCheckType; detailTemp.CheckStatus = material.CheckStatus; detailTemp.SerialNoLength = material.SerialNoLength; detailTemp.NeedVendor = material.NeedVendor; detailTemp.OPBOMSourceItemCode = materialCode; detailTemp.OPBOMItemCode = materialCode; detailTemp.OPBOMItemQty = 1; MINNO newMinno = new MINNO(); newMinno.MOCode = this.edtMoCode.Value.Trim().ToUpper(); newMinno.MItemCode = material.MaterialCode.Trim(); msg = dataCollectFacade.GetMINNOByBarcode(detailTemp, this.edtItemCode.Value.Trim().ToUpper(), this.edtMoCode.Value.Trim().ToUpper(), null, false, true, out newMinno); if (!msg.IsSuccess()) { ApplicationRun.GetInfoForm().Add(msg); this.edtItemCode.TextFocus(true, true); return; } //检查上料资料 if (this.checkCINNO.Checked) { object[] onWipItemObjects = dataCollectFacade.QueryOnWIPItemWithmoCode(this.edtItemCode.Value.Trim().ToUpper(), materialCode, this.edtMoCode.Value.Trim().ToUpper()); if (onWipItemObjects == null) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Have_CollectMertial")); this.edtItemCode.TextFocus(true, true); return; } } this.DataProvider.BeginTransaction(); try { MOFacade moFacade = new MOFacade(this.DataProvider); DBDateTime dBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); Domain.MOModel.MO mo = (Domain.MOModel.MO)moFacade.GetMO(this.edtMoCode.Value.Trim().ToUpper()); SKDCartonDetail newSKDCartonDetail = new SKDCartonDetail(); newSKDCartonDetail.moCode = this.edtMoCode.Value.Trim().ToUpper(); newSKDCartonDetail.CartonNO = this.edtCarton.Value.Trim().ToUpper(); if (mo != null) { newSKDCartonDetail.ItemCode = mo.ItemCode; } newSKDCartonDetail.SBItemCode = materialCode; newSKDCartonDetail.MCard = this.edtItemCode.Value.Trim().ToUpper(); newSKDCartonDetail.MaintainUser = ApplicationService.Current().UserCode; newSKDCartonDetail.MaintainDate = dBDateTime.DBDate; newSKDCartonDetail.MaintainTime = dBDateTime.DBTime; packageFacade.AddSKDCartonDetail(newSKDCartonDetail); ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Success, "$CS_SKDCarton_Succes")); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); msg.Add(new UserControl.Message(ex)); ApplicationRun.GetInfoForm().Add(msg); } finally { this.DataProvider.CommitTransaction(); this.LoadData(); this.MakeGridChecked(); this.edtItemCode.TextFocus(true, true); } } }
private object GetEditObject() { Domain.MOModel.Material material = null; if (this.ValidateInput()) { if (_itemFacade == null) { _itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade(); } material = (Domain.MOModel.Material)_itemFacade.GetMaterial(this.TextBoxMaterialCodeEdit.Text, int.Parse(this.TextBoxOrgIDEdit.Text)); if (material != null) { //Parse Type material.MaterialParseType = string.Empty; if (chkParseBarcode.Checked) { material.MaterialParseType += "," + OPBOMDetailParseType.PARSE_BARCODE; } if (chkParsePrepare.Checked) { material.MaterialParseType += "," + OPBOMDetailParseType.PARSE_PREPARE; } if (chkParseProduct.Checked) { material.MaterialParseType += "," + OPBOMDetailParseType.PARSE_PRODUCT; } if (material.MaterialParseType.Length > 0) { material.MaterialParseType = material.MaterialParseType.Substring(1); } else { material.MaterialParseType = " "; } if (chkParseProduct.Checked && chkCheckStatus.Checked) { material.CheckStatus = BenQGuru.eMES.Web.Helper.FormatHelper.TRUE_STRING; } else { material.CheckStatus = BenQGuru.eMES.Web.Helper.FormatHelper.FALSE_STRING; } //Check Type material.MaterialCheckType = string.Empty; if (chkLinkBarcode.Checked) { material.MaterialCheckType += "," + OPBOMDetailCheckType.CHECK_LINKBARCODE; } if (chkCompareItem.Checked) { material.MaterialCheckType += "," + OPBOMDetailCheckType.CHECK_COMPAREITEM; } if (material.MaterialCheckType.Length > 0) { material.MaterialCheckType = material.MaterialCheckType.Substring(1); } else { material.MaterialCheckType = " "; } if (chkNeedVendor.Checked) { material.NeedVendor = NeedVendor.NeedVendor_Y; } else { material.NeedVendor = NeedVendor.NeedVendor_N; } material.VendorCode = this.txtVendorCode.Text.Trim().ToUpper(); if (chkSNLength.Checked) { int snLength = int.Parse(this.txtSNLength.Text); material.SerialNoLength = snLength; } else { material.SerialNoLength = 0; } //Add By Bernard @ 2010-10-28 material.MaterialControlType = (ddlControlTypeEdit.SelectedValue != "") ? ddlControlTypeEdit.SelectedValue : ""; //Add By jack 2012-03-13 if (chkIsSMT.Checked) { material.IsSMT = MaterialIsSMT.MaterialIsSMT_Y; } else { material.IsSMT = MaterialIsSMT.MaterialIsSMT_N; } } } return(material); }