1
zrg
2025-12-01 fe1720f63330bc451febbe8a3919d5f607e8e70e
DAL/Éú²ú¹ÜÀí/Ä£¾ß¹ÜÀí/ClsSc_MouldProdOutBill.cs
@@ -8,7 +8,7 @@
    public  class ClsSc_MouldProdOutBill:DBUtility.ClsXt_BaseBill
    {
        public Model.ClsSc_MouldProdOutBillMain omodel = new Model.ClsSc_MouldProdOutBillMain();
        public List<Model.ClsSc_MouldStockBillSub> DetailColl = new List<Model.ClsSc_MouldStockBillSub>();
        public List<Model.ClsSc_MouldProdOutBillSub> DetailColl = new List<Model.ClsSc_MouldProdOutBillSub>();
        public ClsSc_MouldProdOutBill()
        {
@@ -30,7 +30,7 @@
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        #endregion
        //保存前控制
        public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 HSecManagerID, Int64 HKeeperID, Int64 HSupID, Int64 OperationType, ref string sReturn)
@@ -86,12 +86,43 @@
            }
        }
        //删除关联(更新源单关联数量)
        public override void DeleteRelation(ref string sReturn, Int64 lngBillKey)
        {
            try
            {
                if (DetailColl[0].HSourceBillType == "3849")    //器具领用申请单
                {
                    oCn.RunProc("exec h_p_Sc_UpDateRelation_MouldOutRequestToMouldProdOut_Del " + lngBillKey.ToString());
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //新增关联(更新源单关联数量)
        public override void AddNewRelation(ref string sReturn, Int64 lngBillKey)
        {
            try
            {
                if (DetailColl[0].HSourceBillType == "3849")    //器具领用申请单
                {
                    oCn.RunProc("exec h_p_Sc_UpDateRelation_MouldOutRequestToMouldProdOut_Add " + lngBillKey.ToString());
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //
                oCn.BeginTran();
                //保存前控制
                if (!BeforeSave(lngBillKey, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 2, ref sReturn))
@@ -109,8 +140,8 @@
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HSupID=" + omodel.HSupID.ToString() +
                ",HSupTypeID=" + omodel.HSupTypeID.ToString() +
                ",HSupID=" + omodel.HSupID.ToString() +
                ",HEmpID=" + omodel.HEmpID.ToString() +
                ",HManagerID=" + omodel.HManagerID.ToString() +
                ",HSecManagerID=" + omodel.HSecManagerID.ToString() +
@@ -129,7 +160,7 @@
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl)
                foreach (Model.ClsSc_MouldProdOutBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_MouldStockBillSub " +
                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
@@ -140,6 +171,8 @@
                      ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" +
                      ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" +
                      ",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" +
                      ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID,HNowModel,HNowLife" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
@@ -149,8 +182,12 @@
                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() +
                      "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" +
                      ",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" +
                      "," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() +
                      ") ");
                }
                //新增关联(更新源单关联数量)
                AddNewRelation(ref sReturn, omodel.HInterID);
                //保存后控制
                if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
                {
@@ -185,29 +222,32 @@
                {
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                oCn.BeginTran();
                //保存前控制
                if (!BeforeSave(omodel.HInterID, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Sc_MouldStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                ",HSupID,HSupTypeID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HWHID,HSCWHID,HRedBlueFlag" +
                ",HExplanation,HInnerBillNo,HStockOrgID" +
                ") " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                ", " + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'" +
                ", " + omodel.HSupID.ToString() + "," + omodel.HSupTypeID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString()+
                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HSTOCKORGID.ToString() +
                ") ");
                //插入子表
                foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl)
                foreach (Model.ClsSc_MouldProdOutBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_MouldStockBillSub " +
                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
@@ -218,6 +258,8 @@
                      ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" +
                      ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" +
                      ",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" +
                      ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID,HNowModel,HNowLife" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
@@ -227,8 +269,12 @@
                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() +
                      "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" +
                      ",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" +
                      "," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() +
                      ") ");
                }
                //新增关联(更新源单关联数量)
                AddNewRelation(ref sReturn, omodel.HInterID);
                //保存后控制
                if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
                {
@@ -332,6 +378,7 @@
                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                //========================================================
                omodel.HSupTypeID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupTypeID"]);
                omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
                omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]);
                omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]);
@@ -343,16 +390,15 @@
                omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]);
                omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]);
                omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]);
                //
                omodel.HSTOCKORGID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HStockOrgID"]);
                //循环
                DataSet DsSub ;
                DsSub = oCn.RunProcReturn("Select * from Sc_MouldStockBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MouldStockBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub();
                    Model.ClsSc_MouldProdOutBillSub oSub = new Model.ClsSc_MouldProdOutBillSub();
                    // å›ºå®šèµ‹å€¼===============================================
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
@@ -372,25 +418,47 @@
                    oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]);
                    oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate"]);
                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
                    oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]);
                    oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]);
                    oSub.HQtyRel = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyRel"]);
                    oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]);
                    oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"]);
                    oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMoney"]);
                    oSub.HDesignLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HDesignLife"]);
                    oSub.HLeaveLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HLeaveLife"]);
                    oSub.HUseLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HUseLife"]);
                    oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HUseLifeQty"]);
                    oSub.HNewLifeQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HNewLifeQty"]);
                    oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]);
                    oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]);
                    oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]);
                    oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]);
                    oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]);
                    oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]);
                    oSub.HDesignLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HDesignLife"]);
                    oSub.HLeaveLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HLeaveLife"]);
                    oSub.HUseLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HUseLife"]);
                    oSub.HBarCode = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBarCode"]);
                    oSub.HCorrespondentTypeID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCorrespondentTypeID"]);
                    oSub.HCorrespondentID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCorrespondentID"]);
                    oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderInterID"]);
                    oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderEntryID"]);
                    oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPOOrderBillNo"]);
                    oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]);
                    oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]);
                    oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]);
                    oSub.HStockOrgID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSTOCKORGID"]);
                    oSub.HOWNERID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HOWNERID"]);
                    oSub.HOtherOrgID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HOtherOrgID"]);
                    oSub.HOWNERTYPEID = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HOWNERTYPEID"]);
                    oSub.HNewModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HNewModel"]);
                    oSub.HWallThickness = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWallThickness"]);
                    oSub.HHardness = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HHardness"]);
                    oSub.HLastProdModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLastProdModel"]);
                    oSub.HDiameter = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDiameter"]);
                    oSub.HBackFlag = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBackFlag"]);
                    oSub.HMouldType = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMouldType"]);
                    oSub.HInitModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HInitModel"]);
                    oSub.HInitDesignLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HInitDesignLife"]);
                    oSub.HLifeUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HLifeUnitID"]);
                    oSub.HNowModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HNowModel"]);
                    oSub.HNowLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HNowLife"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";