/// <summary> /// 根据单据信息操作账务信息与库存信息 /// </summary> /// <param name="dataContext">数据上下文</param> /// <param name="bill">单据信息</param> public void OpertaionDetailAndStock(DepotManagementDataContext dataContext, S_FrockInDepotBill bill) { MaterialRequisitionGoodsServer goodsService = new MaterialRequisitionGoodsServer(); IFinancialDetailManagement serverDetail = ServerModule.ServerModuleFactory.GetServerModule <IFinancialDetailManagement>(); var result = from r in dataContext.S_FrockInDepotGoodsBill where r.Bill_ID == bill.Bill_ID select r; if (result == null || result.Count() == 0) { throw new Exception("获取单据信息失败"); } foreach (var item in result) { S_InDepotDetailBill detailInfo = AssignDetailInfo(dataContext, bill, item); S_Stock stockInfo = AssignStockInfo(dataContext, bill, item); if (detailInfo == null || stockInfo == null) { throw new Exception("获取账务信息或者库存信息失败"); } serverDetail.ProcessInDepotDetail(dataContext, detailInfo, stockInfo); } }
/// <summary> /// 赋值账务信息 /// </summary> /// <param name="ctx">数据上下文</param> /// <param name="bill">单据信息</param> /// <param name="item">明细信息</param> /// <returns>返回账务信息</returns> S_InDepotDetailBill AssignDetailInfo(DepotManagementDataContext ctx, S_FrockInDepotBill bill, S_FrockInDepotGoodsBill item) { IPersonnelInfoServer serverPersonnelInfo = ServerModuleFactory.GetServerModule <IPersonnelInfoServer>(); View_HR_Personnel lnqPersonnel = UniversalFunction.GetPersonnelInfo(ctx, bill.JJRYID); S_InDepotDetailBill lnqDetailBill = new S_InDepotDetailBill(); View_F_GoodsPlanCost lnqBasicGoodsInfo = UniversalFunction.GetGoodsInfo(ctx, item.GoodsID); lnqDetailBill.ID = Guid.NewGuid(); lnqDetailBill.BillTime = (DateTime)bill.InDepotDate; lnqDetailBill.FillInPersonnel = lnqPersonnel.姓名; lnqDetailBill.Department = lnqPersonnel.部门名称; lnqDetailBill.FactPrice = 0; lnqDetailBill.FactUnitPrice = 0; lnqDetailBill.GoodsID = item.GoodsID; lnqDetailBill.BatchNo = item.BatchNo; lnqDetailBill.InDepotBillID = bill.Bill_ID; lnqDetailBill.InDepotCount = item.Amount; lnqDetailBill.Price = 0; lnqDetailBill.UnitPrice = 0; lnqDetailBill.OperationType = (int)CE_SubsidiaryOperationType.自制件工装入库; lnqDetailBill.Provider = bill.Provider; lnqDetailBill.StorageID = bill.StorageID; lnqDetailBill.AffrimPersonnel = bill.DepotManager; lnqDetailBill.FillInDate = bill.Bill_Time; return(lnqDetailBill); }
/// <summary> /// 提交入库信息 /// </summary> /// <param name="inDepotInfo">入库信息, 只取其中入库部分</param> /// <param name="returnInfo">添加完毕后查询数据库的返回结果</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作结果</returns> public bool SubmitInDepotInfo(S_FrockInDepotBill inDepotInfo, out IQueryResult returnInfo, out string error) { returnInfo = null; error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { var result = from r in dataContxt.S_FrockInDepotBill where r.Bill_ID == inDepotInfo.Bill_ID select r; if (result.Count() == 0) { error = string.Format("找不到入库单号为 [{0}] 的自制件工装报检信息!", inDepotInfo.Bill_ID); return(false); } S_FrockInDepotBill lnqBill = result.Single(); if (lnqBill.Bill_Status.Equals("已入库")) { error = string.Format("单据号为 [{0}] 单据状态为已入库", inDepotInfo.Bill_ID); return(false); } lnqBill.DepotManager = inDepotInfo.DepotManager; lnqBill.Bill_Status = inDepotInfo.Bill_Status; lnqBill.InDepotDate = ServerTime.Time; //操作账务信息与库存信息 OpertaionDetailAndStock(dataContxt, lnqBill); //更新工装库存状态 if (!UpdateFrockStockStatus(dataContxt, lnqBill.Bill_ID, out error)) { return(false); } // 正式使用单据号 m_assignBill.UseBillNo(dataContxt, CE_BillTypeEnum.自制件工装报检.ToString(), lnqBill.Bill_ID); dataContxt.SubmitChanges(); return(GetAllBill(out returnInfo, out error)); } catch (Exception exce) { error = exce.Message; return(false); } }
private void 物品入库ToolStripMenuItem_Click(object sender, EventArgs e) { if (!CheckSelectedRow()) { return; } if (!lblBillStatus.Text.Equals("等待入库")) { MessageDialog.ShowPromptMessage("请选择等待入库的记录后再进行此操作!"); return; } if (MessageDialog.ShowEnquiryMessage("您确定已经核实好物品清单了吗?") == DialogResult.No) { return; } string billNo = m_strBillID; S_FrockInDepotBill inDepotInfo = new S_FrockInDepotBill(); inDepotInfo.Bill_ID = billNo; inDepotInfo.DepotManager = BasicInfo.LoginID; inDepotInfo.Bill_Status = "已入库"; inDepotInfo.InDepotDate = ServerTime.Time; if (!m_billServer.SubmitInDepotInfo(inDepotInfo, out m_queryResult, out m_strErr)) { MessageDialog.ShowErrorMessage(m_strErr); return; } StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} 号单据已经入库, ", billNo); EndFlowMessage(sb.ToString()); RefreshDataGridView(m_queryResult); PositioningRecord(billNo); MessageDialog.ShowPromptMessage("成功将零件入库!"); }
/// <summary> /// 添加自制件工装 /// </summary> /// <param name="bill">单据信息</param> /// <param name="returnInfo">添加完毕后查询数据库的返回结果</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作结果</returns> public bool AddBill(S_FrockInDepotBill bill, out IQueryResult returnInfo, out string error) { returnInfo = null; error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { dataContxt.S_FrockInDepotBill.InsertOnSubmit(bill); dataContxt.SubmitChanges(); return(GetAllBill(out returnInfo, out error)); } catch (Exception exce) { error = exce.Message; return(false); } }
/// <summary> /// 赋值库存信息 /// </summary> /// <param name="ctx">数据上下文</param> /// <param name="bill">单据信息</param> /// <param name="item">明细信息</param> /// <returns>返回库存信息对象</returns> S_Stock AssignStockInfo(DepotManagementDataContext ctx, S_FrockInDepotBill bill, S_FrockInDepotGoodsBill item) { S_Stock stock = new S_Stock(); stock.GoodsID = item.GoodsID; stock.Provider = CE_WorkShopCode.JJCJ.ToString(); stock.BatchNo = item.BatchNo; stock.ProviderBatchNo = ""; stock.StorageID = bill.StorageID; stock.ShelfArea = item.ShelfArea; stock.ColumnNumber = item.ColumnNumber; stock.LayerNumber = item.LayerNumber; stock.ExistCount = (decimal)item.Amount; stock.UnitPrice = 0; stock.Price = 0; return(stock); }
public 自制件工装报检明细(CE_BusinessOperateMode operateMode, string billNo) { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); m_operateMode = operateMode; m_billNo = billNo; txtBill_ID.Text = m_billNo; S_FrockInDepotBill tempBill = m_goodsServer.GetBill(billNo); m_lnqWSCode = tempBill == null? m_serverWSBasic.GetPersonnelWorkShop(BasicInfo.LoginID) : m_serverWSBasic.GetPersonnelWorkShop(tempBill.JJRYID); if (m_operateMode == CE_BusinessOperateMode.仓库核实) { 新建toolStripButton1.Visible = false; btnAdd.Enabled = false; btnDelete.Enabled = false; btnDeleteAll.Enabled = false; btnFindCode.Enabled = false; numGoodsAmount.Enabled = false; } else { txtShelf.ReadOnly = true; txtColumn.ReadOnly = true; txtLayer.ReadOnly = true; if (m_operateMode == CE_BusinessOperateMode.查看) { toolStrip1.Visible = false; } else if (m_operateMode == CE_BusinessOperateMode.新建) { dateTime_BillTime.Value = ServerModule.ServerTime.Time; txtJJRY.Text = BasicInfo.LoginName; toolStripSeparator2.Visible = false; toolStripSeparator3.Visible = false; toolStripSeparator7.Visible = false; toolStripSeparatorDelete.Visible = false; toolStripSeparator1.Visible = false; groupBox1.Enabled = false; btnAdd.Visible = false; btnDelete.Visible = false; btnDeleteAll.Visible = false; btnUpdate.Visible = false; } else { 新建toolStripButton1.Visible = false; } } DataTable dt = UniversalFunction.GetStorageTb(); for (int i = 0; i < dt.Rows.Count; i++) { cmbStorage.Items.Add(dt.Rows[i]["StorageName"].ToString()); } cmbStorage.SelectedIndex = -1; StapleInfo.InitUnitComboBox(cmbUnit); // 添加数据定位控件 m_dataLocalizer = new UserControlDataLocalizer(dataGridView1, this.Name, UniversalFunction.SelectHideFields(this.Name, dataGridView1.Name, BasicInfo.LoginID)); groupBox1.Controls.Add(m_dataLocalizer); m_dataLocalizer.Dock = DockStyle.Bottom; m_billInfo = m_goodsServer.GetBill(billNo); if (m_billInfo != null) { txtJJRY.Text = UniversalFunction.GetPersonnelName(m_billInfo.JJRYID); dateTime_BillTime.Value = m_billInfo.Bill_Time; cmbStorage.Text = UniversalFunction.GetStorageName(m_billInfo.StorageID); txtProposer.Text = UniversalFunction.GetPersonnelName(m_billInfo.ProposerID); txtDesigner.Text = UniversalFunction.GetPersonnelName(m_billInfo.DesignerID); txtDepotManager.Text = UniversalFunction.GetPersonnelName(m_billInfo.DepotManager); txtRemark.Text = m_billInfo.Remark; m_queryResultGoods = m_goodsServer.GetGoodsInfo(billNo); if (m_queryResultGoods != null) { RefreshDataGridView(m_queryResultGoods); } } if (!Convert.ToBoolean(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.开启车间管理模块])) { btnBatchNo.Visible = false; } }
private void 新建toolStripButton1_Click(object sender, EventArgs e) { string billNo = txtBill_ID.Text; this.dataGridView1.CellEnter -= new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEnter); if (!CheckDataItem()) { return; } // 如果此单据存在则检查选择行 if (m_goodsServer.IsExist(txtBill_ID.Text)) { //if (!CheckSelectedRow()) // return; } else { S_FrockInDepotBill bill = new S_FrockInDepotBill(); bill.Bill_ID = txtBill_ID.Text; bill.Bill_Time = dateTime_BillTime.Value; bill.JJRYID = BasicInfo.LoginID; bill.ProposerID = txtProposer.Tag as string; bill.DesignerID = "0000"; bill.DepotManager = "0000"; bill.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text); if (txtDesigner.Text == "") { bill.DesignerID = "0000"; } else { bill.DesignerID = txtDesigner.Tag as string; } bill.Provider = txtProvider.Text; // 供应商编码 bill.Depot = txtMaterialType.Text; // 仓库名就是材料类别 bill.Remark = txtRemark.Text; bill.Bill_Status = OrdinaryInDepotBillStatus.新建单据.ToString(); if (cbForck.Checked) { m_blIsCreateFrockStandingBook = true; } else { if (MessageDialog.ShowEnquiryMessage("是否确定单据不生成工装台账?") == DialogResult.Yes) { m_blIsCreateFrockStandingBook = false; } else { m_blIsCreateFrockStandingBook = true; cbForck.Checked = true; } } if (!m_goodsServer.AddBill(bill, out m_queryResult, out m_strErr)) { MessageDialog.ShowErrorMessage(m_strErr); return; } groupBox1.Enabled = true; groupBox1.Enabled = true; toolStripSeparator2.Visible = true; toolStripSeparator3.Visible = true; toolStripSeparator7.Visible = true; toolStripSeparatorDelete.Visible = true; toolStripSeparator1.Visible = true; btnAdd.Visible = true; btnDelete.Visible = true; btnDeleteAll.Visible = true; btnUpdate.Visible = true; 新建toolStripButton1.Visible = false; } }
/// <summary> /// 插入工装所有信息 /// </summary> /// <param name="frockBill">自制件工装信息</param> /// <param name="flag">是否进入工装台帐</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作成功返回True,操作失败返回False</returns> bool CreateNewFrockMessage(S_FrockInDepotBill frockBill, bool flag, out string error) { error = null; FrockProvingReport serverFrockProvingReport = new FrockProvingReport(); try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.S_FrockInDepotGoodsBill where a.Bill_ID == frockBill.Bill_ID select a; foreach (var item in varData) { for (int i = 0; i < item.Amount; i++) { string strFrockNumber = GetNewFrockNumber(); S_FrockProvingReport lnqReport = new S_FrockProvingReport(); lnqReport.DJH = m_assignBill.AssignNewNo(serverFrockProvingReport, "工装验证报告单"); lnqReport.DJZT = "等待检验要求"; lnqReport.BillType = "入库检验"; lnqReport.BZRQ = ServerTime.Time; lnqReport.ConnectBillNumber = frockBill.Bill_ID; lnqReport.FrockNumber = strFrockNumber; lnqReport.GoodsID = item.GoodsID; if (!serverFrockProvingReport.AddBill(lnqReport, null, out error)) { return(false); } m_billMessageServer.SendNewFlowMessage(lnqReport.DJH, string.Format("{0} ※※※ 请【{1}】处理", UniversalFunction.GetGoodsMessage(lnqReport.GoodsID), CE_RoleEnum.工艺人员.ToString()), CE_RoleEnum.工艺人员); if (flag) { S_FrockStandingBook lnqBook = new S_FrockStandingBook(); lnqBook.GoodsID = item.GoodsID; lnqBook.FrockNumber = strFrockNumber; lnqBook.Designer = UniversalFunction.GetPersonnelName(frockBill.DesignerID); if (!m_serverFrockStandingBook.UpdateFrockStandingBook(lnqBook, null, out error)) { return(false); } } } } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }