/// <summary> /// 赋值库存信息 /// </summary> /// <param name="ctx">数据上下文</param> /// <param name="outSourcing">单据信息</param> /// <returns>返回库存信息对象</returns> S_Stock AssignStockInfo(DepotManagementDataContext ctx, S_CheckOutInDepotForOutsourcingBill outSourcing) { View_F_GoodsPlanCost tempGoodsLnq = UniversalFunction.GetGoodsInfo(ctx, outSourcing.GoodsID); if (tempGoodsLnq == null) { throw new Exception("无此物品信息"); } S_Stock stock = new S_Stock(); stock.GoodsID = outSourcing.GoodsID; stock.GoodsCode = tempGoodsLnq.图号型号; stock.GoodsName = tempGoodsLnq.物品名称; stock.Unit = tempGoodsLnq.单位; stock.Spec = tempGoodsLnq.规格; stock.Provider = outSourcing.Provider; stock.ProviderBatchNo = outSourcing.ProviderBatchNo; stock.BatchNo = outSourcing.BatchNo; stock.ShelfArea = outSourcing.ShelfArea; stock.ColumnNumber = outSourcing.ColumnNumber; stock.LayerNumber = outSourcing.LayerNumber; stock.ExistCount = outSourcing.InDepotCount; stock.Date = ServerModule.ServerTime.Time; stock.UnitPrice = outSourcing.UnitPrice; stock.StorageID = outSourcing.StorageID; stock.Version = outSourcing.Version; stock.GoodsStatus = outSourcing.IsOnlyForRepairFlag == true ? 6 : 0; return(stock); }
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); }
/// <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="sender"></param> /// <param name="e"></param> private void btnFindCode_Click(object sender, EventArgs e) { try { ClearControl(); FormQueryInfo form = QueryInfoDialog.GetOrderFormGoodsDialog(m_billInfo.OrderBill_ID, true); IOrderFormInfoServer serviceOrderForm = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>(); View_B_OrderFormInfo orderInfo = serviceOrderForm.GetOrderFormInfo(m_billInfo.OrderBill_ID); if (form != null && form.ShowDialog() == DialogResult.OK) { txtCode.Text = (string)form.GetDataItem("图号型号"); txtName.Text = (string)form.GetDataItem("物品名称"); txtSpec.Text = (string)form.GetDataItem("规格"); IBargainGoodsServer serviceGoodsInfo = ServerModuleFactory.GetServerModule <IBargainGoodsServer>(); numUnitPrice.Value = serviceGoodsInfo.GetGoodsUnitPrice(m_billInfo.OrderBill_ID, Convert.ToInt32(form.GetDataItem("物品ID")), orderInfo.供货单位); numGoodsAmount.Value = (decimal)form.GetDataItem("订货数量"); View_F_GoodsPlanCost planCost = GetBasicGoodsInfo(txtCode.Text, txtName.Text, txtSpec.Text, numUnitPrice.Value); if (planCost != null) { cmbUnit.Text = planCost.单位; numPlanUnitPrice.Value = planCost.单价; } } } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return; } }
/// <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); }
void GetGoodsInfo() { if (txtCode.Tag == null) { lbHYDW.Text = ""; lbKCDW.Text = ""; return; } View_F_GoodsPlanCost tempLnq = UniversalFunction.GetGoodsInfo(Convert.ToInt32(txtCode.Tag)); if (tempLnq == null) { lbHYDW.Text = ""; lbKCDW.Text = ""; return; } lbHYDW.Text = tempLnq.单位; lbKCDW.Text = tempLnq.单位; WS_WorkShopStock tempStock = m_serverStock.GetStockSingleInfo(CE_WorkShopCode.ZPCJ.ToString(), Convert.ToInt32(txtCode.Tag), txtBatchNo.Text); if (tempStock == null) { lbStockCount.Text = "0"; } else { lbStockCount.Text = tempStock.StockCount.ToString(); } }
private void customContextMenuStrip_Edit1__InputEvent(DataTable dtTemp) { List <View_Business_WorkShop_BatchNoChangeDetail> lstDetail = new List <View_Business_WorkShop_BatchNoChangeDetail>(); List <string> lstType = GlobalObject.GeneralFunction.GetEumnList(typeof(CE_WorkShop_BatchNoChangeType)); foreach (DataRow dr in dtTemp.Rows) { View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(dr["图号型号"].ToString().Trim(), dr["物品名称"].ToString().Trim(), dr["规格"].ToString().Trim()); if (goodsInfo == null) { throw new Exception(string.Format("【图号型号】:{0} ,【物品名称】:{1},【规格】:{2} 获取物品信息失败")); } if (!lstType.Contains(dr["管理方式"].ToString().Trim())) { throw new Exception(UniversalFunction.GetGoodsMessage(goodsInfo.序号) + " 【管理方式】不存在"); } View_Business_WorkShop_BatchNoChangeDetail detail = new View_Business_WorkShop_BatchNoChangeDetail(); detail.单据号 = txtBillNo.Text; detail.管理方式 = dr["管理方式"].ToString().Trim(); detail.规格 = goodsInfo.规格; detail.图号型号 = goodsInfo.图号型号; detail.物品ID = goodsInfo.序号; detail.物品名称 = goodsInfo.物品名称; lstDetail.Add(detail); } RefreshDataGridView(lstDetail); }
/// <summary> /// 赋值账务信息 /// </summary> /// <param name="dataContext">数据上下文</param> /// <param name="bill">单据信息</param> /// <param name="item">明细信息</param> /// <returns>返回账务信息</returns> public S_InDepotDetailBill AssignDetailInfo(DepotManagementDataContext dataContext, S_OrdinaryInDepotBill bill, S_OrdinaryInDepotGoodsBill item) { IPersonnelInfoServer personnelServer = ServerModuleFactory.GetServerModule <IPersonnelInfoServer>(); S_InDepotDetailBill detailBill = new S_InDepotDetailBill(); View_HR_Personnel personnel = UniversalFunction.GetPersonnelInfo(dataContext, bill.BuyerCode); View_F_GoodsPlanCost basicGoodsInfo = UniversalFunction.GetGoodsInfo(dataContext, item.GoodsID); detailBill.ID = Guid.NewGuid(); detailBill.BillTime = (DateTime)bill.InDepotDate; detailBill.FillInPersonnel = personnel.姓名; detailBill.Department = personnel.部门名称; detailBill.FactPrice = Math.Round((item.UnitPrice * (decimal)item.Amount), 2); detailBill.FactUnitPrice = item.UnitPrice; detailBill.GoodsID = item.GoodsID; detailBill.BatchNo = item.BatchNo; detailBill.InDepotBillID = bill.Bill_ID; detailBill.InDepotCount = item.Amount; detailBill.Price = Math.Round((item.UnitPrice * (decimal)item.Amount), 2); detailBill.UnitPrice = item.UnitPrice; detailBill.OperationType = (int)GlobalObject.CE_SubsidiaryOperationType.普通入库; detailBill.Provider = bill.Provider; detailBill.StorageID = bill.StorageID; detailBill.AffrimPersonnel = UniversalFunction.GetPersonnelInfo(bill.DepotManager).姓名; detailBill.FillInDate = bill.Bill_Time; return(detailBill); }
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; } }
private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { MessageDialog.ShowPromptMessage("请选择要修改的记录后再进行此操作"); return; } else if (dataGridView1.SelectedRows.Count > 1) { MessageDialog.ShowPromptMessage("只能选择要修改的一条记录后再进行此操作"); return; } if (!CheckDataItem()) { return; } if (Convert.ToBoolean(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.开启车间管理模块]) && txtBatchNo.Text.Trim().Length == 0) { btnBatchNo.Focus(); MessageDialog.ShowPromptMessage("批次号不能为空!"); return; } View_F_GoodsPlanCost planCost = m_planCostServer.GetGoodsInfo(txtCode.Text, txtName.Text, txtSpec.Text, out m_strErr); if (planCost == null) { return; } S_FrockInDepotGoodsBill goods = new S_FrockInDepotGoodsBill(); View_S_FrockInDepotGoodsBill viewGoods = GetGoodsInfo(dataGridView1.SelectedRows[0]); goods.ID = viewGoods.序号; goods.GoodsID = planCost.序号; goods.Amount = numGoodsAmount.Value; if (m_operateMode == CE_BusinessOperateMode.仓库核实) { goods.ShelfArea = txtShelf.Text; goods.ColumnNumber = txtColumn.Text; goods.LayerNumber = txtLayer.Text; } goods.Remark = txtRemarkList.Text; if (!m_goodsServer.UpdateGoods(goods, out m_queryResultGoods, out m_strErr)) { MessageDialog.ShowErrorMessage(m_strErr); return; } int rowIndex = dataGridView1.SelectedRows[0].Index; RefreshDataGridView(m_queryResultGoods); PositioningRecord(rowIndex); }
private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { MessageDialog.ShowPromptMessage("请选择要修改的记录后再进行此操作"); return; } else if (dataGridView1.SelectedRows.Count > 1) { MessageDialog.ShowPromptMessage("只能选择要修改的一条记录后再进行此操作"); return; } if (!CheckDataItem()) { return; } View_F_GoodsPlanCost planCost = GetBasicGoodsInfo(txtCode.Text, txtName.Text, txtSpec.Text, numUnitPrice.Value); if (planCost == null) { return; } S_OrdinaryInDepotGoodsBill goods = new S_OrdinaryInDepotGoodsBill(); View_S_OrdinaryInDepotGoodsBill viewGoods = GetGoodsInfo(dataGridView1.SelectedRows[0]); goods.ID = viewGoods.序号; goods.GoodsID = planCost.序号; goods.ProviderBatchNo = txtProviderBatchNo.Text; goods.BatchNo = txtProviderBatchNo.Tag.ToString(); goods.Amount = numGoodsAmount.Value; goods.UnitPrice = numUnitPrice.Value; goods.Price = Math.Round(numUnitPrice.Value * numGoodsAmount.Value, 2); goods.AmountInWords = CalculateClass.GetTotalPrice(goods.Price); goods.TestingSingle = lnklbSingleBill.Text; if (m_operateMode == CE_BusinessOperateMode.仓库核实) { goods.ShelfArea = txtShelf.Text; goods.ColumnNumber = txtColumn.Text; goods.LayerNumber = txtLayer.Text; } goods.Remark = txtRemark.Text; if (!m_goodsServer.UpdateGoods(goods, out m_queryResult, out m_error)) { MessageDialog.ShowErrorMessage(m_error); return; } int rowIndex = dataGridView1.SelectedRows[0].Index; RefreshDataGridView(m_queryResult); PositioningRecord(rowIndex); }
private void btnPrintBarCode_Click(object sender, EventArgs e) { try { if (dataGridView1.CurrentRow == null) { throw new Exception("选择打印的条形码记录行不允许为空!"); } List <View_S_InDepotGoodsBarCodeTable> lstBarCodeInfo = new List <View_S_InDepotGoodsBarCodeTable>(); IBarCodeServer serviceBarCode = ServerModuleFactory.GetServerModule <IBarCodeServer>(); foreach (DataGridViewRow dgvr in this.dataGridView1.SelectedRows) { View_S_InDepotGoodsBarCodeTable barcode = new View_S_InDepotGoodsBarCodeTable(); QueryCondition_Store tempInfo = new QueryCondition_Store(); tempInfo.BatchNo = dgvr.Cells["批次号"].Value.ToString(); tempInfo.GoodsID = Convert.ToInt32(dgvr.Cells["物品ID"].Value); tempInfo.Provider = m_strProvider; tempInfo.StorageID = m_strStorage; S_Stock stockInfo = UniversalFunction.GetStockInfo(tempInfo); View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(tempInfo.GoodsID); barcode.条形码 = serviceBarCode.GetBarCode(stockInfo.GoodsID, stockInfo.BatchNo, stockInfo.StorageID, stockInfo.Provider); barcode.图号型号 = goodsInfo.图号型号; barcode.物品名称 = goodsInfo.物品名称; barcode.规格 = goodsInfo.规格; barcode.供货单位 = stockInfo.Provider; barcode.批次号 = stockInfo.BatchNo; barcode.货架 = stockInfo.ShelfArea; barcode.层 = stockInfo.LayerNumber; barcode.列 = stockInfo.ColumnNumber; barcode.材料类别编码 = dgvr.Cells["退货数"].Value.ToString(); barcode.物品ID = stockInfo.GoodsID; lstBarCodeInfo.Add(barcode); } foreach (var item in lstBarCodeInfo) { ServerModule.PrintPartBarcode.PrintBarcodeList(item, Convert.ToDecimal(item.材料类别编码)); } MessageBox.Show("条码全部打印完成"); } catch (Exception ex) { MessageDialog.ShowErrorMessage(ex.Message); } }
/// <summary> /// 删除计划价格 /// </summary> /// <param name="planCost">要删除的记录</param> private void DeletePlanPrice(View_F_GoodsPlanCost planCost) { if (planCost.录入员编码 == BasicInfo.LoginID && planCost.日期 == ServerTime.Time.Date) { if (!m_planCostServer.DeleteGoods(planCost.序号, out m_strErr)) { MessageDialog.ShowErrorMessage(m_strErr); } } }
private void btnIn_Click(object sender, EventArgs e) { DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1); if (dtTemp == null) { //MessageDialog.ShowPromptMessage(m_strErr); return; } if (dtTemp.Rows.Count == 0 || dtTemp.Columns[0].ColumnName != "物品ID" || dtTemp.Columns[1].ColumnName != "图号型号" || dtTemp.Columns[2].ColumnName != "物品名称" || dtTemp.Columns[3].ColumnName != "规格" || dtTemp.Columns[4].ColumnName != "单位" || dtTemp.Columns[5].ColumnName != "单价") { MessageDialog.ShowPromptMessage(string.Format("{0} 中没有包含所需的信息,无法导入!", openFileDialog1.FileName)); } else { for (int i = 0; i < dtTemp.Rows.Count; i++) { View_F_GoodsPlanCost tempGoodsLnq = UniversalFunction.GetGoodsInfo(dtTemp.Rows[i]["图号型号"].ToString(), dtTemp.Rows[i]["物品名称"].ToString(), dtTemp.Rows[i]["规格"].ToString()); if (tempGoodsLnq != null) { dtTemp.Rows[i]["物品ID"] = tempGoodsLnq.序号; dtTemp.Rows[i]["单位"] = tempGoodsLnq.单位; } else { dtTemp.Rows.RemoveAt(i); } } if (!m_serverThreePacketsOfTheRepairBill.UpdateAllGoodsUnitPrice( MessageBox.Show("是否删除原有记录", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes? true : false, dtTemp, out m_strErr)) { MessageDialog.ShowPromptMessage(m_strErr); } dataGridView1.DataSource = m_serverThreePacketsOfTheRepairBill.GetGoodsUnitPriceInfo(); userControlDataLocalizer1.Init(dataGridView1, this.Name, UniversalFunction.SelectHideFields(this.Name, dataGridView1.Name, BasicInfo.LoginID)); MessageDialog.ShowPromptMessage("导入成功"); } }
private void btnAdd_Click(object sender, EventArgs e) { if (!CheckDataItem()) { return; } if (Convert.ToBoolean(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.开启车间管理模块]) && txtBatchNo.Text.Trim().Length == 0) { btnBatchNo.Focus(); MessageDialog.ShowPromptMessage("批次号不能为空!"); return; } int planCode = m_planCostServer.GetGoodsID(txtCode.Text, txtName.Text, txtSpec.Text, "030502", (int)cmbUnit.SelectedValue, "自制件工装报检【" + m_billNo + "】自动生成", out m_strErr); S_FrockInDepotGoodsBill goods = new S_FrockInDepotGoodsBill(); View_F_GoodsPlanCost planCost = m_planCostServer.GetGoodsInfo(txtCode.Text, txtName.Text, txtSpec.Text, out m_strErr); if (planCost == null) { return; } goods.Bill_ID = m_billNo; goods.BatchNo = txtBatchNo.Text; goods.Amount = numGoodsAmount.Value; goods.ShelfArea = ""; goods.ColumnNumber = ""; goods.LayerNumber = ""; goods.Remark = txtRemarkList.Text; goods.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text); goods.GoodsID = planCost.序号; foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells["图号型号"].Value.ToString() == txtCode.Text && row.Cells["物品名称"].Value.ToString() == txtName.Text && row.Cells["规格"].Value.ToString() == txtSpec.Text) { MessageDialog.ShowPromptMessage("已经存在相同的物品信息列不允许再进行重复添加!"); return; } } if (!m_goodsServer.AddGoods(m_billNo, goods, out m_queryResultGoods, out m_strErr)) { MessageDialog.ShowErrorMessage(m_strErr); return; } RefreshDataGridView(m_queryResultGoods); PositioningRecord(planCost.图号型号, planCost.物品名称, planCost.规格); }
private void button1_Click(object sender, EventArgs e) { if (txtName.Text.Trim().Length == 0) { MessageBox.Show("请选择物品"); return; } m_GoodsInfo = UniversalFunction.GetGoodsInfo((int)txtCode.Tag); this.DialogResult = DialogResult.OK; this.Close(); }
/// <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="billID">单据编号</param> /// <param name="confirmAmountSignatory">仓库收货员签名</param> /// <param name="goodsAmount">货物数量</param> /// <param name="billStatusInfo">单据状态信息</param> /// <param name="error">出错时返回错误信息</param> /// <returns>操作是否成功的标志</returns> public bool AffirmGoodsAmount(string billID, string confirmAmountSignatory, int goodsAmount, string billStatusInfo, out string error) { error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { var result = from r in dataContxt.S_CheckOutInDepotBill where r.Bill_ID == billID select r; if (result.Count() == 0) { error = string.Format("找不到入库单号为 [{0}] 的报检入库单!", billID); return(false); } S_CheckOutInDepotBill bill = result.Single(); bill.DepotManagerAffirmCount = goodsAmount; bill.BillStatus = billStatusInfo; bill.ConfirmAmountSignatory = confirmAmountSignatory; bill.DepotAffirmanceTime = ServerTime.Time; bill.RebackReason = ""; dataContxt.SubmitChanges(); View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(bill.GoodsID); string strTemp = GlobalObject.GeneralFunction.ListToString <string>(UniversalFunction.GetApplicableMode_CGBOM(bill.GoodsID), ","); List <string> lstText = new List <string>(); lstText.Add(" 物品标识(part list)"); lstText.Add("名称 " + goodsInfo.物品名称); lstText.Add("图号 " + goodsInfo.图号型号); lstText.Add("型号 " + strTemp); lstText.Add("批号 " + bill.BatchNo); lstText.Add("数量 " + bill.DepotManagerAffirmCount.ToString() + "※供应商 " + bill.Provider); lstText.Add("日期 " + ServerTime.Time.ToShortDateString()); ServerModule.PrintPartBarcode.PrintBarcode_Common(lstText); return(true); } catch (Exception exce) { error = exce.Message; return(false); } }
private void customDataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == -1 && e.RowIndex >= 0 && customDataGridView1.CurrentRow.Cells["物品ID"].Value != null && customDataGridView1.CurrentRow.Cells["物品ID"].Value.ToString().Length > 0) { BarCodeInfo barCode = new BarCodeInfo(); barCode.BatchNo = customDataGridView1.CurrentRow.Cells["批次号"].Value == null ? "" : customDataGridView1.CurrentRow.Cells["批次号"].Value.ToString(); barCode.Count = customDataGridView1.CurrentRow.Cells["数量"].Value == null ? 0 : Convert.ToDecimal(customDataGridView1.CurrentRow.Cells["数量"].Value); barCode.GoodsID = Convert.ToInt32(customDataGridView1.CurrentRow.Cells["物品ID"].Value); View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(barCode.GoodsID); barCode.GoodsName = goodsInfo.物品名称; barCode.GoodsCode = goodsInfo.图号型号; barCode.Spec = goodsInfo.规格; CE_BusinessType tempType = CE_BusinessType.库房业务; Service_Manufacture_WorkShop.IWorkShopBasic serverWSBasic = Service_Manufacture_WorkShop.ServerModuleFactory.GetServerModule <Service_Manufacture_WorkShop.IWorkShopBasic>(); WS_WorkShopCode tempWSCode = serverWSBasic.GetWorkShopCodeInfo(txtApplyingDepartment.Tag.ToString()); Dictionary <string, string> tempDic = new Dictionary <string, string>(); CE_InPutBusinessType inPutType = GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(cmbBillType.Text); CE_MarketingType marketType = GlobalObject.EnumOperation.InPutBusinessTypeConvertToMarketingType(inPutType); CE_SubsidiaryOperationType subsdiaryType = GlobalObject.EnumOperation.InPutBusinessTypeConvertToSubsidiaryOperationType(inPutType); tempDic.Add("", marketType.ToString()); if (tempWSCode != null) { tempType = CE_BusinessType.综合业务; tempDic.Add(tempWSCode.WSCode, subsdiaryType.ToString()); } 产品编号 frm = new 产品编号(barCode, tempType, txtBillNo.Text, (lbBillStatus.Text != CE_CommonBillStatus.单据完成.ToString()), tempDic); if (frm.ShowDialog() == DialogResult.OK) { customDataGridView1.Rows[e.RowIndex].Cells["数量"].Value = frm.IntCount; } } }
private void dataGridViewBlankToProduct_CellEnter(object sender, DataGridViewCellEventArgs e) { if (dataGridViewBlankToProduct.CurrentRow != null) { int goodsID = Convert.ToInt32(dataGridViewBlankToProduct.CurrentRow.Cells["物品ID1"].Value); View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(goodsID); txtGoodsCode_Blank.Text = goodsInfo.图号型号; txtGoodsName_Blank.Text = goodsInfo.物品名称; txtSpec_Blank.Text = goodsInfo.规格; txtGoodsCode_Blank.Tag = goodsID; } }
private void btnFindCode_Click(object sender, EventArgs e) { if (lblBillStatus.Text != "新建单据") { return; } FormQueryInfo form; if (chkPayment.Checked) { if (txtOrderForm.Text.Length == 0) { txtOrderForm.Focus(); MessageDialog.ShowPromptMessage(@"请先选择订单/合同号后再进行此操作!"); return; } form = QueryInfoDialog.GetOrderFormGoodsDialog(txtOrderForm.Text, true); } else { form = QueryInfoDialog.GetPlanCostGoodsDialog(true); } if (form == null || form.ShowDialog() != DialogResult.OK) { return; } else { txtCode.Text = form.GetDataItem("图号型号").ToString(); txtName.Text = form.GetDataItem("物品名称").ToString(); txtSpec.Text = form.GetDataItem("规格").ToString(); View_F_GoodsPlanCost tempGoodsInfo = UniversalFunction.GetGoodsInfo(txtCode.Text, txtName.Text, txtSpec.Text); txtCode.Tag = tempGoodsInfo.序号; DataRow dr = m_serverBom.GetBomInfo(txtCode.Text.Trim(), txtName.Text.Trim()); if (dr == null) { txtVersion.Text = ""; } else { txtVersion.Text = dr["Version"].ToString(); } } }
/// <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> /// 获得物品ID /// </summary> /// <param name="goodsCode">图号</param> /// <param name="goodsName">物品名称</param> /// <param name="spec">规格</param> /// <returns>成功返回获取到的物品ID,失败返回0</returns> public int GetGoodsID(string goodsCode, string goodsName, string spec) { string error; View_F_GoodsPlanCost goods = GetGoodsInfo(goodsCode, goodsName, spec, out error); if (goods != null) { return(goods.序号); } else { return(0); } }
/// <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); }
private void btnReferenceInfo_Click(object sender, EventArgs e) { FormQueryInfo form = QueryInfoDialog.GetFrockStandingBook(txtName.Tag == null ? 0 : Convert.ToInt32(txtName.Tag)); if (form != null && form.ShowDialog() == DialogResult.OK) { S_FrockStandingBook lnqTemp = m_serverFrockStandingBook.GetBookInfo(m_lnqStandingBook == null ? Convert.ToInt32(form.GetDataItem("物品ID")) : m_lnqStandingBook.GoodsID, form.GetDataItem("工装编号").ToString()); View_F_GoodsPlanCost tempGoodsLnq = UniversalFunction.GetGoodsInfo(Convert.ToInt32(lnqTemp.GoodsID)); View_F_GoodsPlanCost tempParentGoodsLnq = UniversalFunction.GetGoodsInfo(Convert.ToInt32(lnqTemp.ParentGoodsID)); if (tempParentGoodsLnq != null) { txtParentCode.Text = tempParentGoodsLnq.图号型号; txtParentName.Text = tempParentGoodsLnq.物品名称; txtParentName.Tag = Convert.ToInt32(m_lnqStandingBook.ParentGoodsID); txtParentFrockNumber.Text = m_lnqStandingBook.ParentFrockNumber; } if (tempGoodsLnq == null) { MessageDialog.ShowPromptMessage("系统中无此物品信息"); } txtCode.Text = tempGoodsLnq.图号型号; txtName.Text = tempGoodsLnq.物品名称; txtName.Tag = Convert.ToInt32(lnqTemp.GoodsID); numIdentifyCycle.Value = Convert.ToDecimal(lnqTemp.IdentifyCycle); txtApplyToDevice.Text = lnqTemp.ApplyToDevice; txtApplyToProcess.Text = lnqTemp.ApplyToProcess; txtApplyToProductCode.Text = lnqTemp.ApplyToProductCode; txtApplyToProductName.Text = lnqTemp.ApplyToProductName; txtDesigner.Text = lnqTemp.Designer; cmbApplyToWorkShop.Text = lnqTemp.ApplyToWorkShop; if (lnqTemp.IdentifyCycleType != null) { rbTypeCount.Checked = (bool)(lnqTemp.IdentifyCycleType == rbTypeCount.Text); rbTypeTime.Checked = (bool)(lnqTemp.IdentifyCycleType == rbTypeTime.Text); } } }
/// <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(); }
void AddItem(string barCode) { int goodsID = Convert.ToInt32(barCode.Substring(0, 6)); decimal goodsCount = Convert.ToDecimal(barCode.Substring(6, 5)); View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(goodsID); customDataGridView1.Rows.Add(new object[] { barCode, goodsInfo.序号, goodsInfo.图号型号, goodsInfo.物品名称, goodsInfo.规格, goodsCount, cmbPickingType.Text, txtRemark.Text }); S_MaterialRequisition_BoardIssue issue = new S_MaterialRequisition_BoardIssue(); issue.BarCode = barCode; issue.IssueType = cmbPickingType.Text; issue.Remark = txtRemark.Text; serviceRequistion.AddBoardIssue(issue); }
/// <summary> /// 获取库存中指定物品的供应商信息对话框 /// </summary> /// <param name="goodsID">物品ID</param> /// <param name="providerType">供应商类型</param> /// <returns>成功则返回获取到的对话框,失败返回null</returns> static public FormQueryInfo GetDistinctProviderInfoDialog(int goodsID, CE_ScrapProviderType providerType) { IProviderServer m_providerServer = ServerModuleFactory.GetServerModule <IProviderServer>(); IQueryable <View_Provider> queryResult; System.Data.DataTable dataTable = new DataTable(); switch (providerType) { case CE_ScrapProviderType.责任供应商: if (!m_providerServer.GetDistinctProvider(out queryResult, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return(null); } dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_Provider>(queryResult); break; case CE_ScrapProviderType.供应商: View_F_GoodsPlanCost viewGoods = UniversalFunction.GetGoodsInfo(goodsID); string strSql = " select distinct a.* from View_Provider as a inner join ( " + " select distinct GoodsID, Provider from S_InDepotDetailBill as a " + " union all select distinct GoodsID, Provider from S_Stock) as b " + " on a.供应商编码 = b.Provider inner join F_GoodsPlanCost as c on b.GoodsID = c.ID " + " where GoodsName = '" + viewGoods.物品名称 + "'"; dataTable = GlobalObject.DatabaseServer.QueryInfo(strSql); break; default: break; } FormQueryInfo form = new FormQueryInfo(dataTable); form.ShowColumns = new string[] { "供应商编码" }; return(form); }