/// <summary> /// 更新指定单据物品类别 /// </summary> /// <param name="billNo">单据编号</param> /// <param name="depotType">物品类别</param> /// <param name="returnInfo">操作完毕后查询数据库的返回结果</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作是否成功的标志</returns> public bool UpdateGoodsType(string billNo, string depotType, out IQueryResult returnInfo, out string error) { returnInfo = null; error = null; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; OrdinaryInDepotGoodsBill serverOrdinaryBill = new OrdinaryInDepotGoodsBill(); var result = from r in dataContxt.S_OrdinaryInDepotBill where r.Bill_ID == billNo select r; if (result.Count() == 0) { error = string.Format("找不到入库单号为 [{0}] 的普通入库单!", billNo); return(false); } S_OrdinaryInDepotBill bill = result.Single(); bill.Depot = depotType; IQueryable <S_OrdinaryInDepotGoodsBill> goodsBill = serverOrdinaryBill.GetGoodsInfo(billNo); foreach (var item in goodsBill) { View_F_GoodsPlanCost goodsPlanCost = m_serverBasicGoods.GetGoodsInfoView(item.GoodsID); if (goodsPlanCost != null)// && goodsPlanCost.日期 == ServerTime.Time.Date) { if (goodsPlanCost.录入员编码 != bill.BuyerCode) { error = string.Format("图号型号:{0}, 物品名称:{1}, 规格:{2} 的物品信息在基础物品信息表中由 {3} 创建而不是当前采购员录单时自动创建,无法进行修改,如要更改请与系统管理员联系", goodsPlanCost.图号型号, goodsPlanCost.物品名称, goodsPlanCost.规格, goodsPlanCost.录入员编码); return(false); } //m_serverBasicGoods.UpdateGoodsType(dataContxt, item.GoodsID, depotType); } } dataContxt.SubmitChanges(); return(GetAllBill(out returnInfo, out error)); } catch (Exception exce) { error = exce.Message; return(false); } }
/// <summary> /// 添加自制件入库单 /// </summary> /// <param name="bill">自制件单据信息</param> /// <param name="returnBill">添加完毕后查询数据库的返回结果</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作是否成功的标志</returns> public bool AddBill(S_HomemadePartBill bill, out IQueryResult returnBill, out string error) { returnBill = null; error = null; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; string billID = m_assignBill.AssignNewNo(this, CE_BillTypeEnum.自制件入库单.ToString()); bill.Bill_ID = billID; bill.BatchNo = bill.BatchNo == "系统自动生成" ? billID : bill.BatchNo; bill.Bill_Time = ServerModule.ServerTime.Time; #region 获取计划价格 View_F_GoodsPlanCost basicGoods = m_basicGoodsServer.GetGoodsInfoView(bill.GoodsID); decimal planUnitPrice = basicGoods.单价; bill.PlanUnitPrice = planUnitPrice; bill.PlanPrice = bill.DeclareCount * planUnitPrice; #endregion #region 获取单价 bill.UnitPrice = 0; bill.Price = bill.UnitPrice * bill.DeclareCount; bill.TotalPrice = CalculateClass.GetTotalPrice((decimal)bill.Price); #endregion if (GlobalObject.GeneralFunction.IsNullOrEmpty(bill.Bill_ID)) { throw new Exception("【单据号】获取失败,请重新再试"); } dataContxt.S_HomemadePartBill.InsertOnSubmit(bill); dataContxt.SubmitChanges(); return(GetAllBill(out returnBill, out error)); } catch (Exception exce) { error = exce.Message; return(false); } }
/// <summary> /// 获取指定领料单的物品信息 /// </summary> /// <param name="billNo">领料单号</param> /// <param name="goodsBarCode">条形码物品表信息</param> /// <returns>返回获取的物品信息</returns> public View_S_MaterialRequisitionGoods GetGoods(string billNo, S_InDepotGoodsBarCodeTable goodsBarCode) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; View_F_GoodsPlanCost basicGoods = m_basicGoodsServer.GetGoodsInfoView(goodsBarCode.GoodsID); var result = from r in ctx.View_S_MaterialRequisitionGoods where r.领料单号 == billNo && r.图号型号 == basicGoods.图号型号 && r.物品名称 == basicGoods.物品名称 && r.规格 == basicGoods.规格 && r.供应商编码 == goodsBarCode.Provider && r.批次号 == goodsBarCode.BatchNo select r; if (result.Count() == 0) { return(null); } return(result.Single()); }
/// <summary> /// 接收事件 /// </summary> /// <param name="sender"></param> /// <param name="re">事件参数</param> public Socket_FetchMaterial ReceiveReadBarCodeInfo(Socket_FetchMaterial fetchMaterialInfo) { string error; // 获取物品条形码信息 S_InDepotGoodsBarCodeTable goodsInfo = null; if (!m_barCodeServer.GetData(Convert.ToInt32(fetchMaterialInfo.BarCode), out goodsInfo, out error)) { fetchMaterialInfo.FetchState = Socket_FetchMaterial.FetchStateEnum.条形码有误; return(fetchMaterialInfo); } // 检查领料物品清单中是否存在接收的单据号 if (!m_requestMaterialServer.IsExist(fetchMaterialInfo.BillID)) { fetchMaterialInfo.FetchState = Socket_FetchMaterial.FetchStateEnum.单据号有误; return(fetchMaterialInfo); } // 获取领料单中的物品信息 View_S_MaterialRequisitionGoods goods = m_requestMaterialServer.GetGoods(fetchMaterialInfo.BillID, goodsInfo); if (goods == null) { fetchMaterialInfo.DesireCount = 0; fetchMaterialInfo.FetchState = Socket_FetchMaterial.FetchStateEnum.领料单中无该零件的领料信息; return(fetchMaterialInfo); } View_F_GoodsPlanCost basicGoods = m_basicGoodsServer.GetGoodsInfoView(goodsInfo.GoodsID); fetchMaterialInfo.GoodsCode = basicGoods.图号型号; fetchMaterialInfo.GoodsName = basicGoods.物品名称; fetchMaterialInfo.Spec = basicGoods.规格; fetchMaterialInfo.Provider = goodsInfo.Provider; fetchMaterialInfo.BatchNo = goodsInfo.BatchNo; fetchMaterialInfo.DesireCount = Convert.ToInt32(goods.请领数); fetchMaterialInfo.FetchState = Socket_FetchMaterial.FetchStateEnum.操作成功; return(fetchMaterialInfo); }
/// <summary> /// 显示数据 /// </summary> void ShowMessage() { if (m_lnqBill != null) { View_F_GoodsPlanCost lnqGoods = m_serverGoods.GetGoodsInfoView(m_lnqBill.GoodsID); numAmount.Value = m_lnqBill.Amount; txtCode.Text = lnqGoods.图号型号; txtName.Text = lnqGoods.物品名称; txtSpec.Text = lnqGoods.规格; txtDesigner.Text = m_lnqBill.Designer; txtInspectorVerdict.Text = m_lnqBill.InspectorVerdict; txtJudgeInfo.Text = m_lnqBill.JudgeInfo; txtProvingVerdict.Text = m_lnqBill.ProvingVerdict; txtRemark.Text = m_lnqBill.Remark; lbBillNo.Text = m_lnqBill.Bill_ID; lbBillStatus.Text = m_lnqBill.BillStatus; lbFinalJudge.Text = m_lnqBill.FinalJudge; lbFinalJudgeTime.Text = m_lnqBill.FinalJudgeTime == null ? "" : m_lnqBill.FinalJudgeTime.ToString(); lbInspector.Text = m_lnqBill.Inspector; lbInspectorRequest.Text = m_lnqBill.InspectorRequest; lbInspectorRequestTime.Text = m_lnqBill.InspectorRequestTime == null ? "" : m_lnqBill.InspectorRequestTime.ToString(); lbInspectorTime.Text = m_lnqBill.InspectorTime == null ? "" : m_lnqBill.InspectorTime.ToString(); lbProposer.Text = m_lnqBill.Proposer; lbProposerTime.Text = m_lnqBill.ProposerTime == null ? "" : m_lnqBill.ProposerTime.ToString(); lbProving.Text = m_lnqBill.Proving; lbProvingRequest.Text = m_lnqBill.ProvingRequest; lbProvingRequestTime.Text = m_lnqBill.ProvingRequestTime == null ? "" : m_lnqBill.ProvingRequestTime.ToString(); lbProvingTime.Text = m_lnqBill.ProvingTime == null ? "" : m_lnqBill.ProvingTime.ToString(); if (m_lnqBill.IsOK == null) { rbNo.Checked = false; rbYes.Checked = false; } else { if ((bool)m_lnqBill.IsOK) { rbYes.Checked = true; rbNo.Checked = false; } else { rbNo.Checked = true; rbYes.Checked = false; } } } switch (lbBillStatus.Text) { case "等待检验要求": btnInAdd.Enabled = true; btnInDelete.Enabled = true; btnInUpdate.Enabled = true; txtInInspectionItem.Enabled = true; txtInTechnicalRequirements.Enabled = true; txtInTestingMethod.Enabled = true; txtInTestRecords.Enabled = false; txtInspectorVerdict.Enabled = false; btnProAdd.Enabled = false; btnProDelete.Enabled = false; btnProUpdate.Enabled = false; break; case "等待检验": btnInAdd.Enabled = false; btnInDelete.Enabled = false; btnInUpdate.Enabled = true; txtInInspectionItem.Enabled = false; txtInTechnicalRequirements.Enabled = false; txtInTestingMethod.Enabled = false; txtInTestRecords.Enabled = true; txtInspectorVerdict.Enabled = true; btnProAdd.Enabled = false; btnProDelete.Enabled = false; btnProUpdate.Enabled = false; break; case "等待验证要求": btnInAdd.Enabled = false; btnInDelete.Enabled = false; btnInUpdate.Enabled = false; btnProAdd.Enabled = true; btnProDelete.Enabled = true; btnProUpdate.Enabled = true; txtProInspectionItem.Enabled = true; txtProTechnicalRequirements.Enabled = true; txtProTestingMethod.Enabled = true; txtProTestRecords.Enabled = false; txtProvingVerdict.Enabled = false; break; case "等待验证": btnInAdd.Enabled = false; btnInDelete.Enabled = false; btnInUpdate.Enabled = false; btnProAdd.Enabled = false; btnProDelete.Enabled = false; btnProUpdate.Enabled = true; txtProInspectionItem.Enabled = false; txtProTechnicalRequirements.Enabled = false; txtProTestingMethod.Enabled = false; txtProTestRecords.Enabled = true; txtProvingVerdict.Enabled = true; break; default: btnInAdd.Enabled = false; btnInDelete.Enabled = false; btnInUpdate.Enabled = false; btnProAdd.Enabled = false; btnProDelete.Enabled = false; btnProUpdate.Enabled = false; break; } dataGridViewIn.DataSource = m_dtIn; dataGridViewPro.DataSource = m_dtPro; }