public EntityObjectBase LoadObj(string strType) { string strBillNo = this.Request["BillNo"].ToString(); string strDeptID = this.Request["DeptID"].ToString(); EntityObjectBase eob = null; switch (strType) { case "BOM": BillOfMaterials bom = new BillOfMaterials(); bom.cnvcBillNo = strBillNo; bom.cnvcDeptID = strDeptID; eob = ReportQueryFacade.CommonQuery(bom); break; case "BOV": BillOfValidate bov = new BillOfValidate(); bov.cnvcBillNo = strBillNo; bov.cnvcDeptID = strDeptID; eob = ReportQueryFacade.CommonQuery(bov); break; case "BOS": BillOfOutStorage bos = new BillOfOutStorage(); bos.cnvcBillNo = strBillNo; bos.cnvcDeptID = strDeptID; eob = ReportQueryFacade.CommonQuery(bos); break; } return(eob); }
private void btnOK_Click(object sender, System.EventArgs e) { try { if (!this.BOVValidate()) { return; } BillOfValidate bov = GetBOV(); Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; ReportQueryFacade.UpdateBOV(bov, busiLog); this.Popup("验收单修改成功"); } catch (Exception ex) { this.Popup(ex.Message); } }
private void BindComponent() { BindGoodsName(ddlGoodsName); BindGoodsType(ddlGoodsType, ddlGoodsName.SelectedValue); BindLocalDept(this.txtDeptID, this.txtDeptName); BindPDept(ddlProvideCompany, this.txtDeptID.Text); BillOfValidate bov = LoadObj("BOV") as BillOfValidate; SetBOV(bov); }
private BillOfValidate GetBOV() { Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BillOfValidate _bov = new BillOfValidate(); _bov.SetOriginalValue(); _bov.cnvcBillNo = txtBillNo.Text.Trim(); _bov.cnvcOutNo = txtOutNo.Text.Trim(); _bov.cnvcDeliveryCompany = txtDeliveryComp.Text.Trim(); _bov.cndProvideDate = Convert.ToDateTime(txtProvideDate.Text); _bov.cndDeliveryDate = Convert.ToDateTime(txtDeliveryDate.Text); _bov.cnvcGoodsName = ddlGoodsName.SelectedItem.Text; _bov.cnvcGoodsType = ddlGoodsType.SelectedValue; _bov.cnvcUnit = "KG"; _bov.cnvcTransportLicenseTags = txtTrLicenseTags.Text.Trim(); _bov.cnvcTransportMan = txtTransportMan.Text.Trim(); _bov.cnnOriginalCount = Convert.ToDecimal(txtOriginalCount.Text.Trim()); _bov.cnnValidateCount = Convert.ToDecimal(txtValidateCount.Text.Trim()); _bov.cnnDistance = Convert.ToDecimal(txtDistance.Text.Trim()); _bov.cnnTransportLose = Convert.ToDecimal(txtTransportLose.Text.Trim()); _bov.cnnLose = Convert.ToDecimal(txtLose.Text.Trim()); _bov.cnnQuotaLose = Convert.ToDecimal(txtQuotaLose.Text.Trim()); _bov.cnnOuterLose = Convert.ToDecimal(txtQuterLose.Text.Trim()); _bov.cnvcProvideAddress = txtProvideAddress.Text.Trim(); _bov.cnvcInType = ddlInType.SelectedValue; _bov.cnvcOperName = curOper.cnvcOperName; _bov.cnvcDeptID = this.txtDeptID.Text; switch (_bov.cnvcInType) { case "调拨入库": _bov.cnvcProvideCompany = ddlProvideCompany.SelectedItem.Text; _bov.cnvcProvideDeptID = this.ddlProvideCompany.SelectedValue; break; case "购入": _bov.cnvcProvideCompany = txtProvideCompany.Text; _bov.cnvcProvideDeptID = ""; break; } return(_bov); }
private void SetBOV(BillOfValidate _bov) { this.SetDDLTxt(this.ddlGoodsName, _bov.cnvcGoodsName); this.SetDDL(this.ddlGoodsType, _bov.cnvcGoodsType); this.txtBillNo.Text = _bov.cnvcBillNo; this.txtOutNo.Text = _bov.cnvcOutNo; this.SetDDL(this.ddlInType, _bov.cnvcInType); this.SetDDLTxt(this.ddlProvideCompany, _bov.cnvcProvideCompany); this.txtProvideCompany.Text = _bov.cnvcProvideCompany; this.txtDeliveryComp.Text = _bov.cnvcDeliveryCompany; this.txtProvideDate.Text = _bov.cndProvideDate.ToString("yyyy-MM-dd"); this.txtTrLicenseTags.Text = _bov.cnvcTransportLicenseTags; this.txtTransportMan.Text = _bov.cnvcTransportMan; this.txtDeliveryDate.Text = _bov.cndDeliveryDate.ToString("yyyy-MM-dd"); this.txtOriginalCount.Text = _bov.cnnOriginalCount.ToString(); this.txtValidateCount.Text = _bov.cnnValidateCount.ToString(); this.txtDistance.Text = _bov.cnnDistance.ToString(); this.txtTransportLose.Text = _bov.cnnTransportLose.ToString(); this.txtLose.Text = _bov.cnnLose.ToString(); this.txtQuotaLose.Text = _bov.cnnQuotaLose.ToString(); this.txtQuterLose.Text = _bov.cnnOuterLose.ToString(); this.txtProvideAddress.Text = _bov.cnvcProvideAddress; }
public static void UpdateBOV(BillOfValidate bov, BusiLog bl) { //ConnectionPool.IsCenter = false; using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(IsolationLevel.ReadCommitted); try { string strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString(); DateTime dtSysTime = DateTime.Parse(strSysTime); Dept dept = new Dept(); dept.cnvcDeptID = bov.cnvcDeptID; dept = EntityMapping.Get(dept, trans) as Dept; OilStorage os = new OilStorage(); os.cnvcGoodsName = bov.cnvcGoodsName; os.cnvcGoodsType = bov.cnvcGoodsType; os.cnvcDeptID = bov.cnvcDeptID; os = EntityMapping.Get(os, trans) as OilStorage; if (null == os) { throw new BusinessException(bexType.noobject, "库存获取错误"); } Guid gd = Guid.NewGuid(); //判断修改操作类型 改多为入库 改少为出库 BillOfValidate oldbov = new BillOfValidate(); oldbov.cnvcDeptID = bov.cnvcDeptID; oldbov.cnvcBillNo = bov.cnvcBillNo; oldbov = EntityMapping.Get(oldbov, trans) as BillOfValidate; string strOperType = ""; if (oldbov.cnnValidateCount > bov.cnnValidateCount) { strOperType = InType.BOVModOut; } else { strOperType = InType.BOVModIn; } if (bov.cnnValidateCount != oldbov.cnnValidateCount) { //验收单 //库存日志 OilStorageLog ol = new OilStorageLog(bov.ToTable()); ol.cnvcDeptName = dept.cnvcDeptName; ol.cndOperDate = dtSysTime; ol.cnvcOperType = strOperType; ol.cnnSerial = gd; ol.cnnLastCount = oldbov.cnnValidateCount; //os.cnnStorageCount; ol.cnnInOutCount = bov.cnnValidateCount - oldbov.cnnValidateCount; ol.cnnCurCount = bov.cnnValidateCount; //os.cnnStorageCount + bov.cnnValidateCount - oldbov.cnnValidateCount; EntityMapping.Create(ol, trans); OilStorageLogHis olhis = new OilStorageLogHis(ol.ToTable()); EntityMapping.Create(olhis, trans); oldbov.SynchronizeModifyValue(bov); oldbov.cnnDistance = bov.cnnDistance; oldbov.cnnLose = bov.cnnLose; oldbov.cnnOriginalCount = bov.cnnOriginalCount; oldbov.cnnOuterLose = bov.cnnQuotaLose; oldbov.cnnQuotaLose = bov.cnnQuotaLose; oldbov.cnnTransportLose = bov.cnnTransportLose; oldbov.cnnValidateCount = bov.cnnValidateCount; oldbov.cnvcInType = strOperType; EntityMapping.Update(oldbov, trans); //库存 os.cnnStorageCount = os.cnnStorageCount + ol.cnnInOutCount; //ol.cnnCurCount; EntityMapping.Update(os, trans); } //日志 bl.cnnSerial = gd; bl.cnvcComments = "验收单修改,出入库量:" + (bov.cnnValidateCount - oldbov.cnnValidateCount); bl.cnvcOperType = OperType.OP201; bl.cndOperDate = dtSysTime; bl.cnvcSource = InSource.cs; EntityMapping.Create(bl, trans); trans.Commit(); } catch (BusinessException bex) { trans.Rollback(); LogAdapter.WriteBusinessException(bex); throw bex; } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); throw sex; } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }