private void btnFindCode_Click(object sender, EventArgs e) { ClearControl(); FormQueryInfo form = QueryInfoDialog.GetPlanCostGoodsDialog(); if (form != null && form.ShowDialog() == DialogResult.OK) { txtCode.Text = (string)form.GetDataItem("图号型号"); txtName.Text = (string)form.GetDataItem("物品名称"); txtSpec.Text = (string)form.GetDataItem("规格"); txtCode.Tag = (int)form.GetDataItem("序号"); if (txtSpec.Text.Contains("自制件")) { View_F_GoodsPlanCost planCost = m_planCostServer.GetGoodsInfo(txtCode.Text, txtName.Text, txtSpec.Text, out m_strErr); if (planCost != null) { cmbUnit.Text = planCost.单位; } } else { txtCode.Text = ""; txtName.Text = ""; txtSpec.Text = ""; MessageDialog.ShowPromptMessage("您选择的物品不是属于自制件,【需在物品规格中填写“自制件”字样】,请重新选择或修改物品基础信息的规格信息!"); return; } } }
/// <summary> /// 根据界面信息生成库存对象 /// </summary> /// <returns>生成的库存对象</returns> private S_Stock CreateStockObject() { View_F_GoodsPlanCost info = m_basicGoodsServer.GetGoodsInfo(txtCode.Text, txtName.Text, txtSpec.Text, out m_error); S_Stock stockInfo = new S_Stock(); stockInfo.GoodsID = info.序号; stockInfo.GoodsCode = txtCode.Text; stockInfo.GoodsName = txtName.Text; stockInfo.Spec = txtSpec.Text; stockInfo.Provider = txtProvider.Text; stockInfo.ProviderBatchNo = txtProviderBatchNo.Text; stockInfo.BatchNo = txtBatchNo.Text; stockInfo.Version = txtVersion.Text.Trim(); stockInfo.ShelfArea = txtShelf.Text.Trim().ToUpper(); stockInfo.ColumnNumber = txtColumn.Text.Trim().ToUpper(); stockInfo.LayerNumber = txtLayer.Text.Trim().ToUpper(); stockInfo.ExistCount = numCount.Value; stockInfo.Remark = txtRemark.Text; stockInfo.UnitPrice = numFactUnitPrice.Value; stockInfo.InputPerson = BasicInfo.LoginID; stockInfo.GoodsStatus = (int)cmbGoodsStatus.SelectedValue; stockInfo.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text); return(stockInfo); }
public 营销要货计划交货期设置(string billID, int goodsID, int month, decimal monthCount, string monthName, string yearAndMonth, string billStatus) { InitializeComponent(); m_intGoodsID = goodsID; m_intMonth = month; m_strBillID = billID; txtDJH.Text = m_strBillID; txtName.Text = m_serverBasicGoods.GetGoodsInfo(goodsID).GoodsName; numMonthCount.Value = monthCount; label7.Text = monthName + "月计划总数"; label2.Text = yearAndMonth + "营销计划交货期设置"; dataGridView1.DataSource = m_serverMarketingPlan.GetPlanDeliveryInfo(m_strBillID, m_intGoodsID, m_intMonth); if (billStatus == "新建单据") { btnAdd.Enabled = true; btnDelete.Enabled = true; } else { btnAdd.Enabled = false; btnDelete.Enabled = false; } }
/// <summary> /// 接收事件 /// </summary> /// <param name="sender"></param> /// <param name="re">事件参数</param> public Socket_FetchMaterial ReceiveSaveBarCodeInfo(Socket_FetchMaterial fetchMaterialInfo) { string error; S_MaterialRequisitionGoods goods = new S_MaterialRequisitionGoods(); View_F_GoodsPlanCost basicGoods = m_basicGoodsServer.GetGoodsInfo( fetchMaterialInfo.GoodsCode, fetchMaterialInfo.GoodsName, fetchMaterialInfo.Spec, out error); goods.Bill_ID = fetchMaterialInfo.BillID; goods.GoodsID = basicGoods.序号; goods.ProviderCode = fetchMaterialInfo.Provider; goods.BatchNo = fetchMaterialInfo.BatchNo; goods.RealCount = fetchMaterialInfo.FactCount; if (!m_requestMaterialServer.UpdateyGoodsFromWireless(goods, out error)) { fetchMaterialInfo.FetchState = Socket_FetchMaterial.FetchStateEnum.更新领料清单失败; } else { fetchMaterialInfo.FetchState = Socket_FetchMaterial.FetchStateEnum.操作成功; } return(fetchMaterialInfo); }
public 基础物品信息设置界面(int?goodsID, bool isSave) { InitializeComponent(); m_goodsID = goodsID; if (goodsID == null) { MessageDialog.ShowPromptMessage("【物品信息】异常,请退出当前界面,再试"); this.Close(); } else { lbStock.Text = m_serverStock.GetGoodsStock((int)goodsID).ToString(); m_goodsInfo = m_serverGoods.GetGoodsInfo((int)goodsID); m_lstRecord = m_serverGoods.GetGoodsAttirbuteRecordList((int)m_goodsID); } StapleInfo.InitUnitComboBox(cmbUnit); dataGridViewBlankToProduct.DataSource = new BindingList <View_F_GoodsBlankToProduct>(m_lstBlankToProductInfo); dataGridViewReplace.DataSource = new BindingList <View_F_GoodsReplaceInfo>(m_lstReplaceInfo); dataGridViewWaterCode.DataSource = new BindingList <F_ProductWaterCode>(m_lstWaterCode); ShowInfo(m_goodsInfo, m_lstRecord); if (isSave) { ShowRightControl(); } else { btnSave.Visible = isSave; } }
private void btnFindCode_Click(object sender, EventArgs e) { FormQueryInfo form = QueryInfoDialog.GetPlanCostGoodsDialog(); if (form != null && form.ShowDialog() == DialogResult.OK) { txtCode.Text = form.GetDataItem("图号型号").ToString(); txtCode.Tag = form.GetDataItem("序号").ToString(); txtName.Text = form.GetDataItem("物品名称").ToString(); txtSpec.Text = form.GetDataItem("规格").ToString(); View_F_GoodsPlanCost info = m_basicGoodsServer.GetGoodsInfo(txtCode.Text, txtName.Text, txtSpec.Text, out m_err); if (info != null) { cmbUnit.SelectedValue = info.单位ID; txtMaterialType.Text = info.物品类别名称; txtMaterialType.Tag = info.物品类别; } txtName.ReadOnly = true; txtCode.ReadOnly = true; txtSpec.ReadOnly = true; btnFindMaterialType.Visible = false; } }
public 工装总成信息(int goodsID, string frocknumber, bool flag, AuthorityFlag m_authFlag, bool addflag) { InitializeComponent(); m_strAuthFlag = m_authFlag; FaceAuthoritySetting.SetEnable(this.Controls, m_authFlag); FaceAuthoritySetting.SetVisibly(this.toolStrip1, m_authFlag); toolStrip1.Visible = true; lbScarpPersonnel.Text = ""; lbScarpTime.Text = ""; if (!flag) { labelTitle.Text = "工装分装台帐信息"; this.StartPosition = FormStartPosition.WindowsDefaultLocation; tabControl1.TabPages.RemoveAt(1); } else { labelTitle.Text = "工装总装台帐信息"; } if (addflag) { txtName.ShowResultForm = true; txtFrockNumber.Text = m_serverFrockStandingBook.GetNewFrockNumber(); txtFrockNumber.ReadOnly = false; if (goodsID != 0 && frocknumber != "") { txtParentFrockNumber.Text = frocknumber; F_GoodsPlanCost lnqGoodsInfo = m_serverBasicGoods.GetGoodsInfo(goodsID); txtParentCode.Text = lnqGoodsInfo.GoodsCode; txtParentName.Text = lnqGoodsInfo.GoodsName; txtParentName.Tag = goodsID; } } else { txtName.ShowResultForm = false; txtFrockNumber.ReadOnly = true; DataRow drInfo = m_serverFrockStandingBook.GetInDepotBillInfo(frocknumber); if (drInfo != null) { txtProposer.Text = drInfo["申请人"].ToString(); txtProposer.Tag = drInfo["申请人工号"].ToString(); txtProviderCode.Text = drInfo["供应商编码"].ToString(); txtProviderName.Text = drInfo["供应商简称"].ToString(); txtDesigner.Text = drInfo["设计人"].ToString(); txtDesigner.Tag = drInfo["设计人工号"].ToString(); } m_lnqStandingBook = m_serverFrockStandingBook.GetBookInfo(goodsID, frocknumber); } ShowMessage(); }
/// <summary> /// 获取计划价格表中的物品信息对话框 /// </summary> /// <returns>成功则返回获取到的对话框,失败返回null</returns> static public FormQueryInfo GetPlanCostGoodsDialog(bool blUsing) { IBasicGoodsServer goodsServer = ServerModuleFactory.GetServerModule <IBasicGoodsServer>(); IQueryable <View_F_GoodsPlanCost> queryResult = goodsServer.GetGoodsInfo(blUsing); System.Data.DataTable dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_F_GoodsPlanCost>(queryResult); FormQueryInfo form = new FormQueryInfo(dataTable); form.ShowColumns = new string[] { "图号型号", "物品名称", "规格", "单位", "物品类别", "物品类别名称", "序号" }; return(form); }
/// <summary> /// 从行记录中提取物品对象信息 /// </summary> /// <param name="row">行记录</param> /// <returns>提取的物品信息</returns> View_S_HomemadeRejectList GetGoodsInfo(DataGridViewRow row) { if (row == null) { return(null); } View_S_HomemadeRejectList goods = new View_S_HomemadeRejectList(); goods.序号 = (long)row.Cells["序号"].Value; goods.退货单号 = (string)row.Cells["退货单号"].Value; goods.物品ID = (int)row.Cells["物品ID"].Value; goods.图号型号 = (string)row.Cells["图号型号"].Value; goods.物品名称 = (string)row.Cells["物品名称"].Value; goods.规格 = (string)row.Cells["规格"].Value; goods.供应商 = (string)row.Cells["供应商"].Value; goods.批次号 = (string)row.Cells["批次号"].Value; goods.供方批次 = (string)row.Cells["供方批次"].Value; goods.退货数 = (decimal)row.Cells["退货数"].Value; goods.备注 = (string)row.Cells["备注"].Value; View_F_GoodsPlanCost basicGoodsInfo = null; if (row.Cells["单位"].Value != System.DBNull.Value) { goods.单位 = (string)row.Cells["单位"].Value; goods.物品类别 = (string)row.Cells["物品类别"].Value; goods.货架 = Convert.ToString(row.Cells["货架"].Value); goods.列 = Convert.ToString(row.Cells["列"].Value); goods.层 = Convert.ToString(row.Cells["层"].Value); } else { IBasicGoodsServer basicGoodsServer = ServerModuleFactory.GetServerModule <IBasicGoodsServer>(); basicGoodsInfo = basicGoodsServer.GetGoodsInfo(goods.图号型号, goods.物品名称, goods.规格, out m_strErr); if (!string.IsNullOrEmpty(m_strErr)) { MessageDialog.ShowErrorMessage(m_strErr); return(null); } goods.单位 = basicGoodsInfo.单位; } return(goods); }
/// <summary> /// 从行记录中提取物品对象信息 /// </summary> /// <param name="row">行记录</param> /// <returns>提取的物品信息</returns> View_S_MaterialListRejectBill GetGoodsInfo(DataGridViewRow row) { if (row == null) { return(null); } View_S_MaterialListRejectBill goods = new View_S_MaterialListRejectBill(); goods.序号 = (long)row.Cells["序号"].Value; goods.退货单号 = (string)row.Cells["退货单号"].Value; goods.物品ID = (int)row.Cells["物品ID"].Value; goods.图号型号 = (string)row.Cells["图号型号"].Value; goods.物品名称 = (string)row.Cells["物品名称"].Value; goods.规格 = (string)row.Cells["规格"].Value; goods.供应商 = (string)row.Cells["供应商"].Value; goods.批次号 = (string)row.Cells["批次号"].Value; goods.供方批次 = (string)row.Cells["供方批次"].Value; goods.退货数 = (decimal)row.Cells["退货数"].Value; goods.备注 = (string)row.Cells["备注"].Value; goods.关联单号 = (string)row.Cells["关联单号"].Value; View_F_GoodsPlanCost basicGoodsInfo = null; if (row.Cells["单位"].Value != System.DBNull.Value) { goods.单位 = (string)row.Cells["单位"].Value; goods.物品类别 = (string)row.Cells["物品类别"].Value; goods.货架 = (string)row.Cells["货架"].Value; goods.列 = (string)row.Cells["列"].Value; goods.层 = (string)row.Cells["层"].Value; } else { IBasicGoodsServer basicGoodsServer = ServerModuleFactory.GetServerModule <IBasicGoodsServer>(); basicGoodsInfo = basicGoodsServer.GetGoodsInfo(goods.图号型号, goods.物品名称, goods.规格, out m_error); if (!GlobalObject.GeneralFunction.IsNullOrEmpty(m_error)) { MessageDialog.ShowErrorMessage(m_error); return(null); } goods.单位 = basicGoodsInfo.单位; } return(goods); }
/// <summary> /// 赋值库存信息 /// </summary> /// <param name="dataContxt">数据上下文</param> /// <param name="bill">单据信息</param> /// <param name="item">明细信息</param> /// <returns>返回库存信息对象</returns> S_Stock AssignStockInfo(DepotManagementDataContext dataContxt, S_HomemadeRejectBill bill, S_HomemadeRejectList item) { F_GoodsPlanCost info = m_basicGoodsServer.GetGoodsInfo(dataContxt, item.GoodsID); S_Stock stockInfo = new S_Stock(); stockInfo.GoodsID = info.ID; stockInfo.GoodsCode = info.GoodsCode; stockInfo.GoodsName = info.GoodsName; stockInfo.Spec = info.Spec; stockInfo.Provider = item.Provider; stockInfo.BatchNo = item.BatchNo; stockInfo.ExistCount = item.Amount; stockInfo.StorageID = bill.StorageID; return(stockInfo); }
/// <summary> /// 插入临时表 /// </summary> /// <param name="code">产品型号</param> /// <param name="count">数量</param> public void AddTempTable(string code, decimal count) { DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; S_ForWantingReportTemp lnqFor = new S_ForWantingReportTemp(); IBasicGoodsServer serverGoods = ServerModuleFactory.GetServerModule <IBasicGoodsServer>(); string error = ""; View_F_GoodsPlanCost tempLnq = serverGoods.GetGoodsInfo(code, "", out error); lnqFor.GoodsID = tempLnq == null ? 0 : tempLnq.序号; lnqFor.Count = count; dataContext.S_ForWantingReportTemp.InsertOnSubmit(lnqFor); dataContext.SubmitChanges(); }
/// <summary> /// 获取基础物品信息 /// </summary> /// <param name="code">图号型号</param> /// <param name="name">物品名称</param> /// <param name="spec">规格</param> /// <param name="unitPrice">单价</param> /// <returns>成功返回获取到的信息, 失败返回null</returns> private View_F_GoodsPlanCost GetBasicGoodsInfo(string code, string name, string spec, decimal unitPrice) { //如果指定图号、名称、规则的物品不存在时是否自动向基础物品表中增加明录 //bool autoAddPlanInfo = true; View_F_GoodsPlanCost planCost = m_basicGoodsServer.GetGoodsInfo(code, name, spec, out m_error); if (planCost == null) { MessageDialog.ShowErrorMessage("基础物品表中不存在要增加的物品信息,请及时与仓管员联系!"); return(planCost); } else { if (planCost.单价 != unitPrice || (cmbUnit.Text != "" && planCost.单位 != cmbUnit.Text)) { return(UpdatePlanPrice(planCost, unitPrice)); } } return(planCost); }
/// <summary> /// 匹配物品库存信息 /// </summary> /// <param name="threePacketsOfTheRepairList">数据集</param> /// <param name="error">错误信息</param> /// <returns>返回数据集</returns> DataTable GetStorageTable(DataTable threePacketsOfTheRepairList, out string error) { error = null; threePacketsOfTheRepairList.Columns.Add("StroageID"); threePacketsOfTheRepairList.Columns.Add("Provider"); for (int i = 0; i < threePacketsOfTheRepairList.Rows.Count; i++) { F_GoodsPlanCost lnqGoods = m_serverBasicGoods.GetGoodsInfo(Convert.ToInt32(threePacketsOfTheRepairList.Rows[i]["物品ID"])); string strSql = "select * from S_Stock where GoodsID = " + Convert.ToInt32(threePacketsOfTheRepairList.Rows[i]["物品ID"]) + " and StorageID in( '01','08','11') and BatchNo = '" + threePacketsOfTheRepairList.Rows[i]["批次号"].ToString() + "' and ExistCount >= " + Convert.ToDecimal(threePacketsOfTheRepairList.Rows[i]["领用数量"]) + " order by StorageID desc"; DataTable dtTemp = GlobalObject.DatabaseServer.QueryInfo(strSql); if (dtTemp != null && dtTemp.Rows.Count != 0) { threePacketsOfTheRepairList.Rows[i][13] = dtTemp.Rows[0]["StorageID"].ToString(); threePacketsOfTheRepairList.Rows[i][14] = dtTemp.Rows[0]["Provider"].ToString(); } else { error = "图号型号 【" + lnqGoods.GoodsCode + "】,物品名称 【" + lnqGoods.GoodsName + "】, 规格 【" + lnqGoods.Spec + "】,批次号 【" + threePacketsOfTheRepairList.Rows[i]["批次号"].ToString() + "】 库存不足,请重新核对"; return(null); } } return(threePacketsOfTheRepairList); }
/// <summary> /// 从行记录中提取物品对象信息 /// </summary> /// <param name="row">行记录</param> /// <returns>提取的物品信息</returns> View_S_MaterialDetainList GetGoodsInfo(DataGridViewRow row) { if (row == null) { return(null); } View_S_MaterialDetainList goods = new View_S_MaterialDetainList(); goods.序号 = (int)row.Cells["序号"].Value; goods.扣货单号 = (string)row.Cells["扣货单号"].Value; goods.物品ID = (int)row.Cells["物品ID"].Value; goods.图号型号 = (string)row.Cells["图号型号"].Value; goods.物品名称 = (string)row.Cells["物品名称"].Value; goods.规格 = (string)row.Cells["规格"].Value; goods.供应商 = (string)row.Cells["供应商"].Value; goods.批次号 = (string)row.Cells["批次号"].Value; goods.扣货数 = (decimal)row.Cells["扣货数"].Value; goods.备注 = (string)row.Cells["备注"].Value; goods.单位 = row.Cells["单位"].Value.ToString(); goods.关联订单号 = (string)row.Cells["关联订单号"].Value.ToString(); View_F_GoodsPlanCost basicGoodsInfo = null; IBasicGoodsServer basicGoodsServer = ServerModuleFactory.GetServerModule <IBasicGoodsServer>(); basicGoodsInfo = basicGoodsServer.GetGoodsInfo(goods.图号型号, goods.物品名称, goods.规格, out m_strErr); if (!GlobalObject.GeneralFunction.IsNullOrEmpty(m_strErr)) { MessageDialog.ShowErrorMessage(m_strErr); return(null); } return(goods); }
/// <summary> /// 赋值账务信息 /// </summary> /// <param name="context">数据上下文</param> /// <param name="bill">单据信息</param> /// <param name="item">明细信息</param> /// <returns>返回账务信息对象</returns> public S_FetchGoodsDetailBill AssignDetailInfo(DepotManagementDataContext context, S_MaterialRequisition bill, S_MaterialRequisitionGoods item) { IBillTypeServer server = ServerModuleFactory.GetServerModule <IBillTypeServer>(); BASE_BillType billType = server.GetBillTypeFromName("领料单"); if (billType == null) { throw new Exception("获取不到单据类型信息"); } View_Department department = UniversalFunction.GetDeptInfo(context, bill.Department); IStoreServer storeServer = ServerModuleFactory.GetServerModule <IStoreServer>(); IProductLendReturnService serverLendReturn = ServerModuleFactory.GetServerModule <IProductLendReturnService>(); F_GoodsPlanCost basicGoods = m_basicGoodsServer.GetGoodsInfo(context, item.GoodsID); if (basicGoods == null) { throw new Exception(string.Format("物品ID [{0}] 的物品在基础物品表中没有查到,请与系统管理员联系!", item.GoodsID)); } StoreQueryCondition condition = new StoreQueryCondition(); condition.GoodsID = item.GoodsID; condition.Provider = item.ProviderCode; condition.BatchNo = item.BatchNo; condition.StorageID = bill.StorageID; S_Stock stock = storeServer.GetStockInfoOverLoad(context, condition); if (stock == null && GlobalObject.GeneralFunction.IsNullOrEmpty(basicGoods.GoodsType)) { throw new Exception(string.Format("图号:{0}, 名称:{1}, 规格:{2}, 供应商:{3}, 批次号:{4} 的物品在库存中没有查到相关物品,请仓管员核实!", basicGoods.GoodsCode, basicGoods.GoodsName, basicGoods.Spec, item.ProviderCode, item.BatchNo)); } //S_FetchGoodsDetailBill用于存放每次领料、领料退库的明细信息 decimal dcRealCount = item.RealCount; decimal dcSumCount = 0; var varData = from a in context.View_S_MaterialRequisitionProductReturnList where a.单据号 == item.Bill_ID && a.还账物品ID == item.GoodsID && a.还账物品批次号 == item.BatchNo && a.还账物品供应商 == item.ProviderCode select a; if (varData.Count() > 0) { dcSumCount = varData.Sum(a => a.还账数量); if (dcRealCount < dcSumCount) { throw new Exception("实际领用数量不能大于还货数量,请重新核对"); } } S_FetchGoodsDetailBill detailBill = new S_FetchGoodsDetailBill(); detailBill.ID = Guid.NewGuid(); detailBill.FetchBIllID = bill.Bill_ID; detailBill.BillTime = (DateTime)bill.OutDepotDate; detailBill.AssociatedBillType = bill.AssociatedBillType; detailBill.AssociatedBillNo = bill.AssociatedBillNo; detailBill.Department = department.部门名称; detailBill.FetchCount = item.RealCount; detailBill.GoodsID = item.GoodsID; detailBill.StorageID = bill.StorageID; detailBill.Price = dcSumCount; detailBill.UnitPrice = stock == null ? 0 : stock.UnitPrice; detailBill.OperationType = (int)CE_SubsidiaryOperationType.领料; detailBill.Provider = item.ProviderCode; if (stock != null) { detailBill.ProviderBatchNo = stock.ProviderBatchNo; } else { detailBill.ProviderBatchNo = ""; } detailBill.BatchNo = item.BatchNo; detailBill.FillInPersonnel = bill.FillInPersonnel; detailBill.FinanceSignatory = null; detailBill.DepartDirector = bill.DepartmentDirector; detailBill.DepotManager = bill.DepotManager; detailBill.Remark = (bill.Remark == null ? "" : bill.Remark.Trim()) + (item.Remark == null ? "" : item.Remark.Trim()); detailBill.FillInDate = bill.Bill_Time; IMaterialRequisitionPurposeServer purposeServer = ServerModuleFactory.GetServerModule <IMaterialRequisitionPurposeServer>(); detailBill.Using = purposeServer.GetBillPurpose(context, bill.PurposeCode).Purpose; return(detailBill); }
/// <summary> /// 更新出入库的金额 /// </summary> /// <param name="invoiceTable">需要更新的数据集</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>更新成功True,更新失败False</returns> public bool UpdatePrice(DataTable invoiceTable, out string error) { error = null; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; OrdinaryInDepotBillServer serverOrdinaryBill = new OrdinaryInDepotBillServer(); MaterialRejectBill serverMaterialRejectBill = new MaterialRejectBill(); DateTime dtStart = new DateTime(); DateTime dtEnd = new DateTime(); //获得当前日期的月结起始日期与结束日期 ServerTime.GetMonthlyBalance(ServerTime.Time, out dtStart, out dtEnd); for (int i = 0; i <= invoiceTable.Rows.Count - 1; i++) { string code = invoiceTable.Rows[i]["GoodsCode"].ToString(); string name = invoiceTable.Rows[i]["GoodsName"].ToString(); string spec = invoiceTable.Rows[i]["Spec"].ToString(); View_F_GoodsPlanCost basicGoods = m_basicGoodsServer.GetGoodsInfo(code, name, spec, out error); if (!GlobalObject.GeneralFunction.IsNullOrEmpty(error)) { return(false); } #region 改变入库表的单价(普通入库或者报检入库) var varCheckOutInDepot = from a in dataContxt.S_CheckOutInDepotBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() && a.GoodsID == basicGoods.序号 && a.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select a; //报检入库单单价修改 if (varCheckOutInDepot.Count() != 0) { S_CheckOutInDepotBill lnqCheckOutInDepotBill = varCheckOutInDepot.Single(); lnqCheckOutInDepotBill.UnitInvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqCheckOutInDepotBill.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqCheckOutInDepotBill.HavingInvoice = true; dataContxt.SubmitChanges(); } else { int intGoodsID = m_basicGoodsServer.GetGoodsID(invoiceTable.Rows[i]["GoodsCode"].ToString(), invoiceTable.Rows[i]["GoodsName"].ToString(), invoiceTable.Rows[i]["Spec"].ToString()); var varOrdinaryGoods = from a in dataContxt.S_OrdinaryInDepotGoodsBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() && a.GoodsID == intGoodsID && a.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select a; //普通入库单单价修改 if (varOrdinaryGoods.Count() != 0) { S_OrdinaryInDepotGoodsBill lnqOrdinaryGoods = varOrdinaryGoods.Single(); lnqOrdinaryGoods.InvoiceUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqOrdinaryGoods.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqOrdinaryGoods.HavingInvoice = true; dataContxt.SubmitChanges(); int intFlag = serverOrdinaryBill.GetHavingInvoice(invoiceTable.Rows[i]["Bill_ID"].ToString(), out error); if (intFlag == 4) { return(false); } else { var varOrdinaryBill = from a in dataContxt.S_OrdinaryInDepotBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() select a; if (varOrdinaryBill.Count() != 0) { S_OrdinaryInDepotBill lnqOrdinaryBill = varOrdinaryBill.Single(); lnqOrdinaryBill.InvoiceStatus = intFlag; dataContxt.SubmitChanges(); } } }//采购退货单单价修改 else { intGoodsID = m_basicGoodsServer.GetGoodsID(invoiceTable.Rows[i]["GoodsCode"].ToString(), invoiceTable.Rows[i]["GoodsName"].ToString(), invoiceTable.Rows[i]["Spec"].ToString()); var varRejectList = from a in dataContxt.S_MaterialListRejectBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() && a.GoodsID == intGoodsID && a.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select a; if (varRejectList.Count() != 0) { S_MaterialListRejectBill lnqMaterialList = varRejectList.Single(); lnqMaterialList.InvoiceUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqMaterialList.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqMaterialList.HavingInvoice = true; dataContxt.SubmitChanges(); int intFlag = serverMaterialRejectBill.SetHavingInvoiceReturn(invoiceTable.Rows[i]["Bill_ID"].ToString(), out error); if (intFlag == 4) { return(false); } else { var varReject = from a in dataContxt.S_MaterialRejectBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() select a; if (varReject.Count() != 0) { S_MaterialRejectBill lnqMaterialBill = varReject.Single(); lnqMaterialBill.InvoiceFlag = intFlag; dataContxt.SubmitChanges(); } } } else { intGoodsID = m_basicGoodsServer.GetGoodsID(invoiceTable.Rows[i]["GoodsCode"].ToString(), invoiceTable.Rows[i]["GoodsName"].ToString(), invoiceTable.Rows[i]["Spec"].ToString()); var varOutsourcing = from a in dataContxt.S_CheckOutInDepotForOutsourcingBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() && a.GoodsID == intGoodsID && a.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select a; //委外报检入库单单价修改 if (varOutsourcing.Count() != 0) { S_CheckOutInDepotForOutsourcingBill lnqOutsourcing = varOutsourcing.Single(); lnqOutsourcing.UnitInvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqOutsourcing.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqOutsourcing.HavingInvoice = true; dataContxt.SubmitChanges(); } } } } #endregion #region 改变入库明细表金额 var varInDepotBill = from b in dataContxt.S_InDepotDetailBill where b.GoodsID == basicGoods.序号 && b.InDepotBillID == invoiceTable.Rows[i]["Bill_ID"].ToString() && b.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select b; if (varInDepotBill.Count() == 1) { S_InDepotDetailBill lnqInDepotBill = varInDepotBill.Single(); lnqInDepotBill.InvoiceUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqInDepotBill.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); if (lnqInDepotBill.FactPrice != Convert.ToDecimal(invoiceTable.Rows[i]["Price"])) { //当查询的记录不在当月的结算日期范围内,插入红冲单据与对冲单据 if (lnqInDepotBill.BillTime < dtStart || lnqInDepotBill.BillTime > dtEnd) { var varDetail = from d in dataContxt.S_InDepotDetailBill where d.GoodsID == basicGoods.序号 && d.InDepotBillID.Contains(invoiceTable.Rows[i]["Bill_ID"].ToString()) && d.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() && d.BillTime >= dtStart && d.BillTime <= dtEnd select d; //判断是否已经在当前结算日期范围内插入了红冲与对冲数据 if (varDetail.Count() != 0) { foreach (var item in varDetail) { //针对已经插入的对冲数据进行修改 if (item.InDepotBillID.Contains("(对冲单据)")) { item.FactPrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); item.FactUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); } } }//对没有插入的红冲与对冲的记录进行插入 else { //插一条原始的负记录(红冲单据) S_InDepotDetailBill lnqOldInDepotBill = new S_InDepotDetailBill(); lnqOldInDepotBill.ID = Guid.NewGuid(); lnqOldInDepotBill.InDepotBillID = lnqInDepotBill.InDepotBillID + "(红冲单据)"; lnqOldInDepotBill.BatchNo = lnqInDepotBill.BatchNo; lnqOldInDepotBill.BillTime = ServerTime.Time; lnqOldInDepotBill.Department = lnqInDepotBill.Department; lnqOldInDepotBill.FactUnitPrice = lnqInDepotBill.FactUnitPrice; lnqOldInDepotBill.FactPrice = -lnqInDepotBill.FactPrice; lnqOldInDepotBill.FillInPersonnel = lnqInDepotBill.FillInPersonnel; lnqOldInDepotBill.GoodsID = lnqInDepotBill.GoodsID; lnqOldInDepotBill.InDepotCount = -lnqInDepotBill.InDepotCount; lnqOldInDepotBill.Price = -lnqInDepotBill.Price; lnqOldInDepotBill.OperationType = (int)GlobalObject.CE_SubsidiaryOperationType.财务红冲; lnqOldInDepotBill.Provider = lnqInDepotBill.Provider; lnqOldInDepotBill.Remark = lnqInDepotBill.Remark; lnqOldInDepotBill.StorageID = lnqInDepotBill.StorageID; lnqOldInDepotBill.UnitPrice = lnqInDepotBill.UnitPrice; lnqOldInDepotBill.FillInDate = lnqInDepotBill.FillInDate; lnqOldInDepotBill.AffrimPersonnel = lnqInDepotBill.AffrimPersonnel; IFinancialDetailManagement serverDetail = ServerModule.ServerModuleFactory.GetServerModule <IFinancialDetailManagement>(); serverDetail.ProcessInDepotDetail(dataContxt, lnqOldInDepotBill, null); //插一条新的正记录(对冲单据) S_InDepotDetailBill lnqNewInDepotBill = new S_InDepotDetailBill(); lnqNewInDepotBill.ID = Guid.NewGuid(); lnqNewInDepotBill.InDepotBillID = lnqInDepotBill.InDepotBillID + "(对冲单据)"; lnqNewInDepotBill.BatchNo = lnqInDepotBill.BatchNo; lnqNewInDepotBill.BillTime = ServerTime.Time; lnqNewInDepotBill.Department = lnqInDepotBill.Department; lnqNewInDepotBill.FactUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqNewInDepotBill.FactPrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqNewInDepotBill.FillInPersonnel = lnqInDepotBill.FillInPersonnel; lnqNewInDepotBill.GoodsID = lnqInDepotBill.GoodsID; lnqNewInDepotBill.InDepotCount = lnqInDepotBill.InDepotCount; lnqNewInDepotBill.Price = lnqInDepotBill.Price; lnqNewInDepotBill.OperationType = (int)GlobalObject.CE_SubsidiaryOperationType.财务对冲; lnqNewInDepotBill.Provider = lnqInDepotBill.Provider; lnqNewInDepotBill.Remark = lnqInDepotBill.Remark; lnqNewInDepotBill.StorageID = lnqInDepotBill.StorageID; lnqNewInDepotBill.UnitPrice = lnqInDepotBill.UnitPrice; lnqNewInDepotBill.FillInDate = lnqInDepotBill.FillInDate; lnqNewInDepotBill.AffrimPersonnel = lnqInDepotBill.AffrimPersonnel; serverDetail.ProcessInDepotDetail(dataContxt, lnqNewInDepotBill, null); } } else { lnqInDepotBill.FactPrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqInDepotBill.FactUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); } } dataContxt.SubmitChanges(); } #endregion } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 更改数据CVT客户基础信息 /// </summary> /// <param name="cvtCustomer">CVT客户信息</param> /// <param name="error">c错误信息</param> /// <returns>更改成功返回True,更改失败返回False</returns> public bool UpdateCVTCustomerInformation(YX_CVTCustomerInformation cvtCustomer, out string error) { error = null; try { DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.YX_CVTCustomerInformation where a.ID != cvtCustomer.ID && a.VehicleShelfNumber == cvtCustomer.VehicleShelfNumber select a; if (varData.Count() != 0) { error = "数据不唯一"; return(false); } else { var varCVT = from a in dataContext.YX_CVTCustomerInformation where a.ID == cvtCustomer.ID select a; if (varCVT.Count() == 1) { YX_CVTCustomerInformation lnqCustomer = varCVT.Single(); lnqCustomer.CarModelID = cvtCustomer.CarModelID; lnqCustomer.ClientName = cvtCustomer.ClientName; lnqCustomer.CVTNumber = cvtCustomer.CVTNumber; lnqCustomer.DealerName = cvtCustomer.DealerName; lnqCustomer.FullAddress = cvtCustomer.FullAddress; lnqCustomer.PhoneNumber = cvtCustomer.PhoneNumber; lnqCustomer.ProductID = cvtCustomer.ProductID; lnqCustomer.Remark = cvtCustomer.Remark; lnqCustomer.SellDate = cvtCustomer.SellDate; lnqCustomer.SiteCity = cvtCustomer.SiteCity; lnqCustomer.SiteProvince = cvtCustomer.SiteProvince; lnqCustomer.VehicleShelfNumber = cvtCustomer.VehicleShelfNumber; lnqCustomer.VKT = cvtCustomer.VKT; lnqCustomer.OverTheReason = cvtCustomer.OverTheReason; lnqCustomer.ProofNo = cvtCustomer.ProofNo; var varInfo = from a in dataContext.YX_CVTCustomerInformation where a.VehicleShelfNumber == cvtCustomer.VehicleShelfNumber select a; if (varInfo.Count() == 1) { YX_CVTCustomerInformation lnqInfo = varInfo.Single(); if (lnqInfo.CVTNumber != cvtCustomer.CVTNumber) { YX_CVTCustomerInformationHistory lnqCustomerHistory = new YX_CVTCustomerInformationHistory(); IProductListServer serverProcutList = ServerModuleFactory.GetServerModule <IProductListServer>(); lnqCustomerHistory.CarModel = serverProcutList.GetMotorcycleInfo(Convert.ToInt32(cvtCustomer.CarModelID)); lnqCustomerHistory.ClientName = cvtCustomer.ClientName; IBasicGoodsServer serverBasicGoods = ServerModuleFactory.GetServerModule <IBasicGoodsServer>(); F_GoodsPlanCost lnqGoods = serverBasicGoods.GetGoodsInfo(Convert.ToInt32(cvtCustomer.ProductID)); lnqCustomerHistory.CVTType = lnqGoods.GoodsCode; lnqCustomerHistory.DealerName = cvtCustomer.DealerName; lnqCustomerHistory.FinishDate = ServerTime.Time; lnqCustomerHistory.FinishPersonnel = BasicInfo.LoginName; lnqCustomerHistory.NewPartCode = cvtCustomer.CVTNumber; lnqCustomerHistory.OldPartCode = lnqInfo.CVTNumber; lnqCustomerHistory.Remark = "手动修改"; lnqCustomerHistory.ReplaceCode = lnqGoods.GoodsCode; lnqCustomerHistory.ReplaceName = lnqGoods.GoodsName; lnqCustomerHistory.ReplaceSpec = lnqGoods.Spec; lnqCustomerHistory.VehicleShelfNumber = cvtCustomer.VehicleShelfNumber; dataContext.YX_CVTCustomerInformationHistory.InsertOnSubmit(lnqCustomerHistory); } } } } dataContext.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }