public override void LoadFormInfo() { try { m_billNoControl = new BillNumberControl(CE_BillTypeEnum.整台份请领单.ToString(), m_serviceWholeMachine); m_lnqBillInfo = m_serviceWholeMachine.GetSingleBillInfo(this.FlowInfo_BillNo); this.图号型号.m_OnCompleteSearch += new GlobalObject.DelegateCollection.NonArgumentHandle(图号型号_m_OnCompleteSearch); this.库房名称.m_OnCompleteSearch += new GlobalObject.DelegateCollection.NonArgumentHandle(库房名称_m_OnCompleteSearch); SetInfo(); } catch (Exception ex) { MessageDialog.ShowErrorMessage(ex.Message); } }
public void AutoFirstMaterialRequisition(string billNo, out List <string> listBillNo) { listBillNo = null; DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serverFlow.GetNextBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } try { if (billStatus == CE_CommonBillStatus.单据完成.ToString()) { var varBill = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition where a.BillNo == billNo select a; Business_WarehouseOutPut_WholeMachineRequisition lnqWholeBill = varBill.Single(); var varDetail = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisitionDetail where a.BillNo == billNo select a; List <Business_WarehouseOutPut_WholeMachineRequisitionDetail> listDetail = varDetail.ToList(); var varStorage = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition_StorageID where a.BillNo == billNo select a; List <Business_WarehouseOutPut_WholeMachineRequisition_StorageID> listStorage = varStorage.ToList(); CreateMaterialRequisition(ctx, lnqWholeBill, listDetail, listStorage, out listBillNo); ctx.Transaction.Commit(); } } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
public void SignFinish(string billNo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition where a.BillNo == billNo select a; if (varData.Count() == 1) { Business_WarehouseOutPut_WholeMachineRequisition wholeMachine = varData.Single(); wholeMachine.SignFinish = true; } ctx.SubmitChanges(); }
void SetInfo() { if (m_lnqBillInfo != null) { lbBillStatus.Text = m_serverFlow.GetNowBillStatus(m_lnqBillInfo.BillNo); txtBillNo.Text = m_lnqBillInfo.BillNo; txtRemark.Text = m_lnqBillInfo.Remark; txtProductType.Text = m_lnqBillInfo.ProductType; numRequestCount.Value = m_lnqBillInfo.MachineCount; txtPurpose.Text = m_lnqBillInfo.BillTypeDetail; if (lbBillStatus.Text != CE_CommonBillStatus.新建单据.ToString()) { this.groupBox1.Enabled = false; } if (lbBillStatus.Text == CE_CommonBillStatus.等待审核.ToString()) { this.添加ToolStripMenuItem1.Visible = false; this.添加ToolStripMenuItem2.Visible = false; this.除ToolStripMenuItem1.Visible = false; this.除ToolStripMenuItem2.Visible = false; this.customDataGridView1.ReadOnly = true; this.customDataGridView2.ReadOnly = true; } } else { lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString(); m_lnqBillInfo = new Business_WarehouseOutPut_WholeMachineRequisition(); txtBillNo.Text = this.FlowInfo_BillNo; m_lnqBillInfo.BillNo = txtBillNo.Text; } m_listViewDetail = m_serviceWholeMachine.GetListViewDetailInfo(m_lnqBillInfo.BillNo); m_listStorageID = m_serviceWholeMachine.GetListViewStorageIDInfo(m_lnqBillInfo.BillNo); RefreshDataGridView(m_listViewDetail, m_listStorageID); }
private bool customForm_PanelGetDateInfo(CE_FlowOperationType flowOperationType) { try { if (!CheckData()) { return(false); } m_lnqBillInfo = new Business_WarehouseOutPut_WholeMachineRequisition(); m_lnqBillInfo.BillNo = txtBillNo.Text; m_lnqBillInfo.BillTypeDetail = txtPurpose.Text; m_lnqBillInfo.ProductType = txtProductType.Text.ToString(); m_lnqBillInfo.MachineCount = numRequestCount.Value; m_lnqBillInfo.Remark = txtRemark.Text; m_lnqBillInfo.IncludeAfterSupplement = chbIncludeAfterSupplement.Checked; List <View_Business_WarehouseOutPut_WholeMachineRequisitionDetail> listDetail = new List <View_Business_WarehouseOutPut_WholeMachineRequisitionDetail>(); foreach (DataGridViewRow dgvr in customDataGridView1.Rows) { View_Business_WarehouseOutPut_WholeMachineRequisitionDetail detailTemp = new View_Business_WarehouseOutPut_WholeMachineRequisitionDetail(); detailTemp.单据号 = txtBillNo.Text; detailTemp.单位 = dgvr.Cells["单位"].Value == null ? "" : dgvr.Cells["单位"].Value.ToString(); detailTemp.规格 = dgvr.Cells["规格"].Value == null ? "" : dgvr.Cells["规格"].Value.ToString(); detailTemp.数量 = Convert.ToDecimal(dgvr.Cells["数量"].Value); detailTemp.基数 = Convert.ToDecimal(dgvr.Cells["基数"].Value); detailTemp.图号型号 = dgvr.Cells["图号型号"].Value == null ? "" : dgvr.Cells["图号型号"].Value.ToString(); detailTemp.物品ID = Convert.ToInt32(dgvr.Cells["物品ID"].Value); detailTemp.物品名称 = dgvr.Cells["物品名称"].Value == null ? "" : dgvr.Cells["物品名称"].Value.ToString(); listDetail.Add(detailTemp); } List <View_Business_WarehouseOutPut_WholeMachineRequisition_StorageID> listStorage = new List <View_Business_WarehouseOutPut_WholeMachineRequisition_StorageID>(); foreach (DataGridViewRow dgvr in customDataGridView2.Rows) { View_Business_WarehouseOutPut_WholeMachineRequisition_StorageID storageTemp = new View_Business_WarehouseOutPut_WholeMachineRequisition_StorageID(); storageTemp.单据号 = txtBillNo.Text; storageTemp.库房名称 = dgvr.Cells["库房名称"].Value == null ? "" : dgvr.Cells["库房名称"].Value.ToString(); storageTemp.库房代码 = dgvr.Cells["库房代码"].Value == null ? "" : dgvr.Cells["库房代码"].Value.ToString(); storageTemp.库房顺序 = dgvr.Cells["库房顺序"].Value == null ? 0 : Convert.ToInt32(dgvr.Cells["库房顺序"].Value.ToString()); listStorage.Add(storageTemp); } this.FlowInfo_BillNo = txtBillNo.Text; this.ResultList = new List <object>(); this.ResultList.Add(m_lnqBillInfo); this.ResultList.Add(listDetail); this.ResultList.Add(listStorage); this.ResultList.Add(flowOperationType); return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
void CreateMaterialRequisition(DepotManagementDataContext ctx, Business_WarehouseOutPut_WholeMachineRequisition billInfo, List <Business_WarehouseOutPut_WholeMachineRequisitionDetail> listDetail, List <Business_WarehouseOutPut_WholeMachineRequisition_StorageID> listStorage, out List <string> listBillNo) { listBillNo = null; ServerModule.IMaterialRequisitionGoodsServer serviceGoods = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IMaterialRequisitionGoodsServer>(); ServerModule.IMaterialRequisitionServer serviceBill = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IMaterialRequisitionServer>(); ServerModule.IStoreServer serviceStore = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IStoreServer>(); IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); ServerModule.IMaterialRequisitionPurposeServer servicePurpose = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IMaterialRequisitionPurposeServer>(); BillNumberControl billControl = new BillNumberControl(CE_BillTypeEnum.领料单, serviceBill); List <CommonProcessInfo> listProcessInfo = serviceFlow.GetFlowData(billInfo.BillNo); try { List <GoodsInfo> listGoodsInfo = new List <GoodsInfo>(); foreach (Business_WarehouseOutPut_WholeMachineRequisitionDetail detail in listDetail) { decimal requstCount = detail.GoodsCount; foreach (Business_WarehouseOutPut_WholeMachineRequisition_StorageID storage in listStorage) { if (requstCount == 0) { break; } List <View_S_Stock> lstStock = serviceStore.GetGoodsStoreOnlyForAssembly(detail.GoodsID, storage.StorageID).ToList(); foreach (View_S_Stock stock in lstStock) { if (requstCount == 0) { break; } if (stock.库存数量 <= requstCount) { GoodsInfo goodsInfo = new GoodsInfo(); goodsInfo.GoodsID = detail.GoodsID; goodsInfo.BatchNo = stock.批次号; goodsInfo.Provider = stock.供货单位; goodsInfo.GoodsCount = stock.库存数量; goodsInfo.ListInfo = new List <string>(); goodsInfo.ListInfo.Add(listGoodsInfo.Count.ToString()); goodsInfo.ListInfo.Add(storage.StorageID); goodsInfo.ListInfo.Add(stock.库存数量.ToString()); listGoodsInfo.Add(goodsInfo); requstCount = requstCount - stock.库存数量; } else { GoodsInfo goodsInfo = new GoodsInfo(); goodsInfo.GoodsID = detail.GoodsID; goodsInfo.BatchNo = stock.批次号; goodsInfo.Provider = stock.供货单位; goodsInfo.GoodsCount = requstCount; goodsInfo.ListInfo = new List <string>(); goodsInfo.ListInfo.Add(listGoodsInfo.Count.ToString()); goodsInfo.ListInfo.Add(storage.StorageID); goodsInfo.ListInfo.Add(detail.GoodsCount.ToString()); listGoodsInfo.Add(goodsInfo); requstCount = 0; } } } } if (listGoodsInfo != null && listGoodsInfo.Count > 0) { listBillNo = new List <string>(); CommonProcessInfo firstProcess = new CommonProcessInfo(); CommonProcessInfo SecondProcess = new CommonProcessInfo(); CommonProcessInfo ThridProcess = new CommonProcessInfo(); var varTemp = from a in listProcessInfo where a.操作节点 == "新建" orderby a.时间 descending select a; if (varTemp.Count() != 0) { firstProcess = varTemp.First(); } else { throw new Exception("此单据无【新建】流程"); } varTemp = from a in listProcessInfo where a.操作节点 == "审核" orderby a.时间 descending select a; if (varTemp.Count() != 0) { SecondProcess = varTemp.First(); } else { throw new Exception("此单据无【审核】流程"); } varTemp = from a in listProcessInfo where a.操作节点 == "确认" orderby a.时间 descending select a; if (varTemp.Count() != 0) { ThridProcess = varTemp.First(); } foreach (Business_WarehouseOutPut_WholeMachineRequisition_StorageID storage in listStorage) { List <GoodsInfo> listGoodsInfoTemp = (from a in listGoodsInfo where a.ListInfo[1].ToString() == storage.StorageID orderby Convert.ToInt32(a.ListInfo[0]) select a).ToList(); if (listGoodsInfoTemp.Count > 0) { string error = ""; S_MaterialRequisition bill = new S_MaterialRequisition(); bill.AssociatedBillNo = billInfo.BillNo; bill.AssociatedBillType = CE_BillTypeEnum.整台份请领单.ToString(); bill.Bill_ID = billControl.GetNewBillNo(ctx); bill.Bill_Time = ServerTime.Time; bill.BillStatus = "等待出库"; View_HR_Personnel personnelInfo = UniversalFunction.GetPersonnelInfo(firstProcess.工号); bill.Department = personnelInfo.部门编码; bill.DepartmentDirector = SecondProcess.人员; bill.DepotManager = ThridProcess == new CommonProcessInfo() ? BasicInfo.LoginName : ThridProcess.人员; bill.FetchCount = (int)billInfo.MachineCount; bill.FetchType = FetchGoodsType.整台领料.ToString(); bill.FillInPersonnel = firstProcess.人员; bill.FillInPersonnelCode = personnelInfo.工号; bill.ProductType = billInfo.ProductType; bill.PurposeCode = servicePurpose.GetBillPurpose(ctx, billInfo.BillTypeDetail).Code; bill.Remark = billInfo.Remark; bill.StorageID = storage.StorageID; if (!serviceBill.AutoCreateBill(ctx, bill, out error)) { throw new Exception(error); } listBillNo.Add(bill.Bill_ID); for (int i = 0; i < listGoodsInfoTemp.Count; i++) { S_MaterialRequisitionGoods goodsInfo = new S_MaterialRequisitionGoods(); goodsInfo.BasicCount = Convert.ToDecimal(listGoodsInfoTemp[i].ListInfo[2]); goodsInfo.BatchNo = listGoodsInfoTemp[i].BatchNo; goodsInfo.Bill_ID = bill.Bill_ID; goodsInfo.GoodsID = listGoodsInfoTemp[i].GoodsID; goodsInfo.ProviderCode = listGoodsInfoTemp[i].Provider; goodsInfo.RealCount = listGoodsInfoTemp[i].GoodsCount; goodsInfo.Remark = GetWorkBench_WashFlag(billInfo.ProductType, goodsInfo.GoodsID); goodsInfo.RequestCount = listGoodsInfoTemp[i].GoodsCount; IProductOrder serviceProductOrder = ServerModuleFactory.GetServerModule <IProductOrder>(); goodsInfo.ShowPosition = 0; //serviceProductOrder.GetPosition(ctx, billInfo.ProductType, goodsInfo.GoodsID); if (!serviceGoods.AutoCreateGoods(ctx, goodsInfo, out error)) { throw new Exception(error); } } } ctx.SubmitChanges(); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void AutoSupplementaryRequisition(string billNo, out List <string> listBillNo) { listBillNo = null; DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serverFlow.GetNowBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } try { if (billStatus == CE_CommonBillStatus.单据完成.ToString()) { var varBill = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition where a.BillNo == billNo select a; Business_WarehouseOutPut_WholeMachineRequisition lnqWholeBill = varBill.Single(); string error = ""; Hashtable hsTable = new Hashtable(); hsTable.Add("@BillNo", billNo); DataTable tempTable = GlobalObject.DatabaseServer.QueryInfoPro("Business_WarehouseOutPut_WholeMachineRequisition_GetLastShortageInfo", hsTable, out error); List <Business_WarehouseOutPut_WholeMachineRequisitionDetail> listDetail = new List <Business_WarehouseOutPut_WholeMachineRequisitionDetail>(); if (tempTable != null && tempTable.Rows.Count > 0) { foreach (DataRow dr in tempTable.Rows) { Business_WarehouseOutPut_WholeMachineRequisitionDetail detail = new Business_WarehouseOutPut_WholeMachineRequisitionDetail(); detail.BillNo = billNo; detail.Cardinality = 0; detail.GoodsCount = Convert.ToDecimal(dr["NeedCount"]); detail.GoodsID = Convert.ToInt32(dr["GoodsID"]); listDetail.Add(detail); } } else { throw new Exception("无物品可生成补领的【领料单】"); } var varStorage = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition_StorageID where a.BillNo == billNo select a; List <Business_WarehouseOutPut_WholeMachineRequisition_StorageID> listStorage = varStorage.ToList(); CreateMaterialRequisition(ctx, lnqWholeBill, listDetail, listStorage, out listBillNo); ctx.Transaction.Commit(); } } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
/// <summary> /// 保存业务信息 /// </summary> /// <param name="billInfo">业务总单信息</param> /// <param name="detailInfo">业务明细信息</param> public void SaveInfo(Business_WarehouseOutPut_WholeMachineRequisition billInfo, List <View_Business_WarehouseOutPut_WholeMachineRequisitionDetail> detailInfo, List <View_Business_WarehouseOutPut_WholeMachineRequisition_StorageID> listStorageID) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { var varData = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition where a.BillNo == billInfo.BillNo select a; if (varData.Count() == 1) { Business_WarehouseOutPut_WholeMachineRequisition lnqBill = varData.Single(); lnqBill.MachineCount = billInfo.MachineCount; lnqBill.ProductType = billInfo.ProductType; lnqBill.Remark = billInfo.Remark; lnqBill.BillTypeDetail = billInfo.BillTypeDetail; lnqBill.IncludeAfterSupplement = billInfo.IncludeAfterSupplement; } else if (varData.Count() == 0) { ctx.Business_WarehouseOutPut_WholeMachineRequisition.InsertOnSubmit(billInfo); } else { throw new Exception("单据数据不唯一"); } #region 添加明细 var varDetail = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisitionDetail where a.BillNo == billInfo.BillNo select a; ctx.Business_WarehouseOutPut_WholeMachineRequisitionDetail.DeleteAllOnSubmit(varDetail); ctx.SubmitChanges(); foreach (View_Business_WarehouseOutPut_WholeMachineRequisitionDetail item in detailInfo) { Business_WarehouseOutPut_WholeMachineRequisitionDetail lnqDetail = new Business_WarehouseOutPut_WholeMachineRequisitionDetail(); lnqDetail.BillNo = billInfo.BillNo; lnqDetail.GoodsCount = item.数量; lnqDetail.GoodsID = item.物品ID; lnqDetail.Cardinality = item.基数; ctx.Business_WarehouseOutPut_WholeMachineRequisitionDetail.InsertOnSubmit(lnqDetail); } ctx.SubmitChanges(); #endregion #region 添加库房顺序 var varStorageID = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition_StorageID where a.BillNo == billInfo.BillNo select a; ctx.Business_WarehouseOutPut_WholeMachineRequisition_StorageID.DeleteAllOnSubmit(varStorageID); ctx.SubmitChanges(); foreach (View_Business_WarehouseOutPut_WholeMachineRequisition_StorageID item1 in listStorageID) { Business_WarehouseOutPut_WholeMachineRequisition_StorageID lnqStorage = new Business_WarehouseOutPut_WholeMachineRequisition_StorageID(); lnqStorage.BillNo = billInfo.BillNo; lnqStorage.StorageID = item1.库房代码; lnqStorage.OrderID = item1.库房顺序; ctx.Business_WarehouseOutPut_WholeMachineRequisition_StorageID.InsertOnSubmit(lnqStorage); } ctx.SubmitChanges(); #endregion ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
bool 整台份请领单_Form_CommonProcessSubmit(CustomFlowForm form, string advise) { IWholeMachineRequisitionService m_serviceWholeMachine = Service_Manufacture_Storage.ServerModuleFactory.GetServerModule <IWholeMachineRequisitionService>(); try { Business_WarehouseOutPut_WholeMachineRequisition lnqRequisition = form.ResultList[0] as Business_WarehouseOutPut_WholeMachineRequisition; List <View_Business_WarehouseOutPut_WholeMachineRequisitionDetail> detailInfo = form.ResultList[1] as List <View_Business_WarehouseOutPut_WholeMachineRequisitionDetail>; List <View_Business_WarehouseOutPut_WholeMachineRequisition_StorageID> storageInfo = form.ResultList[2] as List <View_Business_WarehouseOutPut_WholeMachineRequisition_StorageID>; this.OperationType = GeneralFunction.StringConvertToEnum <CE_FlowOperationType>(form.ResultList[3].ToString()); this.BillNo = lnqRequisition.BillNo; switch (this.OperationType) { case CE_FlowOperationType.提交: List <string> listBillNo = new List <string>(); m_serviceWholeMachine.SaveInfo(lnqRequisition, detailInfo, storageInfo); m_serviceWholeMachine.AutoFirstMaterialRequisition(lnqRequisition.BillNo, out listBillNo); if (listBillNo != null && listBillNo.Count > 0) { string msg = ""; foreach (string billNoTemp in listBillNo) { msg = msg + "【" + billNoTemp + "】,"; } msg = msg.Substring(0, msg.Length - 1); MessageDialog.ShowPromptMessage("已生成领料单 " + msg); } break; case CE_FlowOperationType.暂存: m_serviceWholeMachine.SaveInfo(lnqRequisition, detailInfo, storageInfo); break; case CE_FlowOperationType.回退: break; case CE_FlowOperationType.未知: break; default: break; } if (!m_serviceWholeMachine.IsExist(lnqRequisition.BillNo)) { MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面"); return(false); } return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }