jingh
2021-09-13 fcc6bf3f4e0d50b0c7a6e66c8c4abe672d8be495
DAL/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipMaintainPlanBill.cs
@@ -9,11 +9,11 @@
    {
        public Model.ClsSb_EquipMaintainPlanBillMain omodel = new Model.ClsSb_EquipMaintainPlanBillMain();
        public List<Model.ClsSb_EquipMaintainPlanBillSub> DetailColl = new List<Model.ClsSb_EquipMaintainPlanBillSub>();
        public List<Model.ClsSc_EquipMaintainPlanBillSub_Item> DetailCol = new List<Model.ClsSc_EquipMaintainPlanBillSub_Item>();
        public ClsSb_EquipMaintainPlanBill()
        {
            base.MvarItemKeySub = "Sb_EquipMaintainPlanBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub2 = "Sb_EquipMaintainPlanBillSub_Item";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey="Sb_EquipMaintainPlanBillMain";
@@ -45,7 +45,7 @@
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDater='" + omodel.HMaker + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HEquipID=" + omodel.HEquipID.ToString() +
@@ -60,8 +60,10 @@
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                DeleteBillSub2(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                //插入配件项子表
                foreach (Model.ClsSb_EquipMaintainPlanBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sb_EquipMaintainPlanBillSub " +
@@ -78,18 +80,23 @@
                      //"," + oSub.HManagerID.ToString()+",'" +oSub.HManagerNumber+"'"+
                      ") ");
                }
                //
                //foreach (Model.ClsSb_EquipMaintainPlanBillSub oSub in DetailColl)
                //{
                //    Ds = oCn.RunProcReturn("exec h_p_Sb_EquipMaintainPlanBill_Qty " + oSub.HICMOInterID, "");
                //    if (Ds.Tables[0].Rows.Count == 0)
                //        return;
                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
                //    {
                //        sReturn = "汇报数量超过计划数量!不允许保存";
                //        return false;
                //    }
                //}
                //插入保养项子表
                foreach (Model.ClsSc_EquipMaintainPlanBillSub_Item Item in DetailCol)
                {
                    oCn.RunProc("Insert into Sb_EquipMaintainPlanBillSub_Item" +
                          " (HInterID,HEntryID,HMaintainItemID,HMaintainItem" +
                          ",HMaintainPart,HClaim" +
                          ",HManagerID" +
                          ",HCloseMan,HCloseType,HRemark" +
                          ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                          ") values("
                          + omodel.HInterID.ToString() + "," + Item.HEntryID.ToString() + "," + Item.HMaintainItemID.ToString() + ",'" + Item.HMaintainItem.ToString() + "'" +
                          ",'" + Item.HMaintainPart.ToString() + "','" + Item.HClaim.ToString() + "'" +
                          "," + Item.HManagerID.ToString() +
                          ",'" + Item.HCloseMan + "'," + Convert.ToString(Item.HCloseType ? 1 : 0) + ",'" + Item.HRemark + "'" +
                          "," + Item.HSourceInterID.ToString() + "," + Item.HSourceEntryID.ToString() + ",'" + Item.HSourceBillNo + "','" + Item.HSourceBillType + "'," + Item.HRelationQty.ToString() + "," + Item.HRelationMoney.ToString() +
                          ") ");
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -116,11 +123,11 @@
                ",HYear,HPeriod,HRemark,HEquipID" +
                ",HBeginDate,HEndDate,HCheckCycle,HCycleUnit,HExplanation,HInnerBillNo" +
                ") "+
                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" +
                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'," + omodel.HEquipID.ToString() +
                ",'" + omodel.HBeginDate +"','" +omodel.HEndDate + "'," + omodel.HCheckCycle.ToString() +",'"+ omodel.HCycleUnit + "','" + omodel.HExplanation + "','" + omodel.HInnerBillNo +"'" +
                ") ");
                //插入子表
                //插入配件子表
                foreach (Model.ClsSb_EquipMaintainPlanBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sb_EquipMaintainPlanBillSub " +
@@ -137,19 +144,23 @@
                        //"," + oSub.HManagerID.ToString()+",'" +oSub.HManagerNumber+"'"+
                      ") ");
                }
                //
                //foreach (Model.ClsSb_EquipMaintainPlanBillSub oSub in DetailColl)
                //{
                //    Ds = oCn.RunProcReturn("exec h_p_Sb_EquipMaintainPlanBill_Qty " + oSub.HICMOInterID, "");
                //    if (Ds.Tables[0].Rows.Count == 0)
                //        return;
                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
                //    {
                //        sReturn = "汇报数量超过计划数量!不允许保存";
                //        return false;
                //    }
                //}
                //
                //插入保养项子表
                foreach (Model.ClsSc_EquipMaintainPlanBillSub_Item Item in DetailCol)
                {
                    oCn.RunProc("Insert into Sb_EquipMaintainPlanBillSub_Item" +
                          " (HInterID,HEntryID,HMaintainItemID,HMaintainItem" +
                          ",HMaintainPart,HClaim" +
                          ",HManagerID" +
                          ",HCloseMan,HCloseType,HRemark" +
                          ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                          ") values("
                          + omodel.HInterID.ToString() + "," + Item.HEntryID.ToString() + "," + Item.HMaintainItemID.ToString() + ",'" + Item.HMaintainItem.ToString() + "'" +
                          ",'" + Item.HMaintainPart.ToString() + "','" + Item.HClaim.ToString() + "'" +
                          "," + Item.HManagerID.ToString() +
                          ",'" + Item.HCloseMan + "'," + Convert.ToString(Item.HCloseType ? 1 : 0) + ",'" + Item.HRemark + "'" +
                          "," + Item.HSourceInterID.ToString() + "," + Item.HSourceEntryID.ToString() + ",'" + Item.HSourceBillNo + "','" + Item.HSourceBillType + "'," + Item.HRelationQty.ToString() + "," + Item.HRelationMoney.ToString() +
                          ") ");
                }
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;