private void txtStorageCount_GotFocus(object sender, EventArgs e) { string strGoodsName = cmbGoodsName.Text.Trim(); string strGoodsType = cmbGoodsType.Text.Trim(); if (strGoodsName == "" || strGoodsType == "") { MessageBox.Show("物料参数不全,请检查参数!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } err = null; CMSMStruct.OilStorageStruct oils = cs.GetOilStorageDetail(strGoodsName, strGoodsType, out err); if (err != null) { MessageBox.Show("获取当前库存出错,请检查当前库存信息,再重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err); return; } if (oils == null) { this.txtStorageCount.Text = "初始库存"; this.txtLoseCount.Text = "0"; this.txtLoseCount.ReadOnly = true; } else { this.txtStorageCount.Text = oils.dStorageCount.ToString(); } }
private void BOSADD() { if (!BOSValidate()) { return; } string strGoodsName = cmbGoodsName.Text.Trim(); string strGoodsType = cmbGoodsType.Text.Trim(); double doutcount = double.Parse(txtCount.Text.Trim()); err = null; CMSMStruct.OilStorageStruct oils = cs.GetOilStorageDetail(strGoodsName, strGoodsType, out err); if (err != null || oils == null) { MessageBox.Show("获取当前库存出错,请检查当前库存信息,再重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err); return; } else if (oils.dStorageCount < doutcount) { MessageBox.Show("当前库存不足,请检查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } string strDeliveryDeptID = GetDDeptID(); if (strDeliveryDeptID == "") { return; } CMSMStruct.BillOfOutStorageStruct billofout = new CMSMData.CMSMStruct.BillOfOutStorageStruct(); billofout.strBillNo = txtBillNo.Text.Trim(); billofout.strProvideStroage = txtProvideStroage.Text.Trim(); billofout.strDeliveryCompany = cmbDeliveryCompany.Text.Trim(); billofout.strMoveNo = txtMoveNo.Text.Trim(); billofout.strBillOfMaterialsNo = txtBillOfMaterialsNo.Text.Trim(); billofout.strTransportCompany = txtTransportCompany.Text.Trim(); billofout.strTransportLiscenseTags = txtTransportLiscenseTags.Text.Trim(); billofout.strOutStorageDate = dtpOutStorageDate.Value.ToShortDateString(); billofout.strGoodsName = strGoodsName; billofout.strGoodsType = strGoodsType; billofout.strUnit = "KG"; billofout.strReceivableCount = txtReceivableCount.Text.Trim(); billofout.strCount = txtCount.Text.Trim(); billofout.strComments = txtComments.Text.Trim(); billofout.strStorageIncharge = txtStorageIncharge.Text.Trim(); billofout.strDeliveryMan = txtDeliveryMan.Text.Trim(); billofout.strLister = txtLister.Text.Trim(); billofout.strOutType = "调拨出库"; billofout.strOperName = SysInitial.CurOps.strOperName; billofout.strOperDate = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToLongTimeString(); billofout.strDeptID = SysInitial.LocalDeptID; billofout.strDeliveryDeptID = strDeliveryDeptID; CMSMStruct.OilStorageLogStruct oilslog = new CMSMData.CMSMStruct.OilStorageLogStruct(); oilslog.strDeptName = SysInitial.LocalDeptName; oilslog.strGoodsName = oils.strGoodsName; oilslog.strGoodsType = oils.strGoodsType; oilslog.strInOutCount = (-double.Parse(billofout.strCount)).ToString(); oilslog.strLastCount = oils.dStorageCount.ToString(); oilslog.strCurCount = (Math.Round(oils.dStorageCount - double.Parse(billofout.strCount), 2)).ToString(); oilslog.strOperType = "调拨出库"; oilslog.strOperName = billofout.strOperName; oilslog.strOperDate = billofout.strOperDate; oilslog.strDeptID = SysInitial.LocalDeptID; DialogResult drMG = MessageBox.Show(this, "是否要对\r 出库单号单号:【" + billofout.strBillNo + "】,物料名称:【" + billofout.strGoodsName + "】,物料型号:【" + billofout.strGoodsType + "】,实发数:【" + billofout.strCount + "】\r是否继续出库?", "请仔细核对调拨出库单据准确无误后再点“是”否则点“否”!!!", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); if (drMG == DialogResult.No) { return; } err = null; if (cs.InsertBillOfOutStorage(billofout, oilslog, out err)) { MessageBox.Show("油料出库单录入成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return; } else { MessageBox.Show("油料出库单录入失败!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err); return; } }
private void BOMADD() { string strGoodsName = cmbGoodsName.Text.Trim(); string strGoodsType = cmbGoodsType.Text.Trim(); if (!BOMValidate()) { return; } double doutcount = double.Parse(txtCount.Text.Trim()); err = null; CMSMStruct.OilStorageStruct oils = cs.GetOilStorageDetail(strGoodsName, strGoodsType, out err); if (err != null || oils == null) { MessageBox.Show("获取当前库存出错,请检查当前库存信息,再重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err); return; } else if (oils.dStorageCount < doutcount) { MessageBox.Show("当前库存不足,请检查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } CMSMStruct.BillOfMaterialsStruct billofmat = new CMSMData.CMSMStruct.BillOfMaterialsStruct(); billofmat.strBillNo = txtBillNo.Text.Trim(); billofmat.strContractNo = cmbContractNo.Text.Trim(); billofmat.strDeliveryCompany = cmbDeliveryCompany.Text.Trim(); billofmat.strProvideCompany = txtProvideCompany.Text.Trim(); billofmat.strGoodsName = strGoodsName; billofmat.strGoodsType = strGoodsType; billofmat.strUnit = "KG"; billofmat.strReceiveCount = txtReceiveCount.Text.Trim(); billofmat.strCount = txtCount.Text.Trim(); billofmat.strDeliveryMan = txtDeliveryMan.Text.Trim(); billofmat.strDeliveryDate = dtpDeliveryDate.Value.ToShortDateString(); billofmat.strProvideBeginDate = dtpProvideBeginDate.Value.ToShortDateString(); billofmat.strProvideEndDate = dtpProvideEndDate.Value.ToShortDateString(); billofmat.strProvideMan = txtProvideMan.Text.Trim(); billofmat.strSignerCompany = txtSignerCompany.Text.Trim(); billofmat.strSigner = txtSigner.Text.Trim(); billofmat.strTimeOfValidity = dtpProvideEndDate.Value.ToShortDateString(); billofmat.strOperName = SysInitial.CurOps.strOperName; billofmat.strOperDate = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToLongTimeString(); billofmat.strSpecialUnitPrice = txtSpecialUnitPrice.Text.Trim(); billofmat.strSpecialFee = txtSpecialFee.Text.Trim(); billofmat.strDeptID = SysInitial.LocalDeptID; CMSMStruct.OilStorageLogStruct oilslog = new CMSMData.CMSMStruct.OilStorageLogStruct(); oilslog.strDeptName = SysInitial.LocalDeptName; oilslog.strGoodsName = oils.strGoodsName; oilslog.strGoodsType = oils.strGoodsType; oilslog.strInOutCount = (-double.Parse(billofmat.strCount)).ToString(); oilslog.strLastCount = oils.dStorageCount.ToString(); oilslog.strCurCount = (Math.Round(oils.dStorageCount - double.Parse(billofmat.strCount), 2)).ToString(); oilslog.strOperType = "专供油出库"; oilslog.strOperName = billofmat.strOperName; oilslog.strOperDate = billofmat.strOperDate; DialogResult drMG = MessageBox.Show(this, "是否要对\r专供油领料单号:【" + billofmat.strBillNo + "】,物料名称:【" + billofmat.strGoodsName + "】,物料型号:【" + billofmat.strGoodsType + "】,实发数量:【" + billofmat.strCount + "】\r是否继续入库?", "请仔细核对专供油单据准确无误后再点“是”否则点“否”!!!", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); if (drMG == DialogResult.No) { return; } err = null; if (cs.InsertBillOfMaterials(billofmat, oilslog, out err)) { MessageBox.Show("专供油领料单录入成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return; } else { MessageBox.Show("专供油领料单录入失败!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err); return; } }
private void sbtnOk_Click(object sender, System.EventArgs e) { string strGoodsName = cmbGoodsName.Text.Trim(); string strGoodsType = cmbGoodsType.Text.Trim(); if (strGoodsName == "" || strGoodsType == "") { MessageBox.Show("物料参数不全,请检查参数!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } if (txtStorageCount.Text.Trim() == "请点击此处...") { MessageBox.Show("请先获取当前库存!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } err = null; CMSMStruct.OilStorageStruct oils = cs.GetOilStorageDetail(strGoodsName, strGoodsType, out err); if (err != null) { MessageBox.Show("获取当前库存出错,请检查当前库存信息,再重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } return; } else if (oils == null && this.txtStorageCount.Text.Trim() == "初始库存") { oils = new CMSMData.CMSMStruct.OilStorageStruct(); oils.strGoodsType = strGoodsType; oils.strGoodsName = strGoodsName; oils.dStorageCount = 0; oils.strDeptName = SysInitial.LocalDeptName; oils.strDeptID = SysInitial.LocalDeptID; } else { if (oils.dStorageCount != double.Parse(txtStorageCount.Text.Trim())) { MessageBox.Show("当前库存和之前获取的有差异,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); this.Close(); return; } } if (txtCount.Text.Trim() == "" || txtLoseCount.Text.Trim() == "") { MessageBox.Show("实际库存和损耗不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } CMSMData.CMSMStruct.OilStorageCheckStruct oilcheck = new CMSMData.CMSMStruct.OilStorageCheckStruct(); oilcheck.strGoodsName = strGoodsName; oilcheck.strGoodsType = strGoodsType; oilcheck.dStorageCount = oils.dStorageCount; oilcheck.dLoseCount = double.Parse(txtLoseCount.Text.Trim()); oilcheck.dCount = double.Parse(txtCount.Text.Trim()); oilcheck.strDeptName = oils.strDeptName; oilcheck.strOperName = SysInitial.CurOps.strOperName; oilcheck.strOperDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); oilcheck.strDeptID = SysInitial.LocalDeptID; if (oilcheck.dCount <= 0) { MessageBox.Show("实际库存应大于0,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } if (this.txtStorageCount.Text.Trim() != "初始库存" && (Math.Round(oilcheck.dStorageCount - oilcheck.dLoseCount)) != Math.Round(oilcheck.dCount)) { MessageBox.Show("库存数量减去损耗与实际库存不相符,请检查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } CMSMData.CMSMStruct.OilStorageLogStruct oilslog = new CMSMData.CMSMStruct.OilStorageLogStruct(); oilslog.strDeptName = SysInitial.LocalDeptName; oilslog.strGoodsName = oilcheck.strGoodsName; oilslog.strGoodsType = oilcheck.strGoodsType; if (this.txtStorageCount.Text.Trim() == "初始库存") { oilslog.strInOutCount = oilcheck.dCount.ToString(); } else { oilslog.strInOutCount = (-oilcheck.dLoseCount).ToString(); } oilslog.strLastCount = oils.dStorageCount.ToString(); oilslog.strCurCount = oilcheck.dCount.ToString(); oilslog.strOperType = "库存盘点"; oilslog.strOperName = oilcheck.strOperName; oilslog.strOperDate = oilcheck.strOperDate; oilslog.strDeptID = SysInitial.LocalDeptID; err = null; if (cs.InsertOilStorageCheck(oilcheck, oilslog, out err)) { MessageBox.Show("库存盘点成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); this.txtStorageCount.Text = "请点击此处..."; this.txtLoseCount.Text = ""; this.txtCount.Text = ""; this.txtLoseCount.ReadOnly = false; return; } else { MessageBox.Show("库存盘点失败!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); this.txtStorageCount.Text = "请点击此处..."; this.txtLoseCount.Text = ""; this.txtCount.Text = ""; this.txtLoseCount.ReadOnly = false; clog.WriteLine(err); return; } }