1
wtt
2025-04-21 797e02f68d79c931233f25af1d39bc136ce6185d
WebAPI/DLL/ClsSb_EquipDotCheckBill.cs
@@ -38,6 +38,22 @@
            {
                //
                oCn.BeginTran();
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Sb_EquipDotCheckBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "'2 ", "h_p_Sb_EquipDotCheckBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                //更新主表
                oCn.RunProc("UpDate Sb_EquipDotCheckBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
@@ -89,6 +105,23 @@
                //        return false;
                //    }
                //}
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Sb_EquipDotCheckBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',2 ", "h_p_Sb_EquipDotCheckBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -107,6 +140,22 @@
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Sb_EquipDotCheckBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Sb_EquipDotCheckBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
@@ -115,11 +164,12 @@
                ",HYear,HPeriod,HRemark,HEquipID" +
                ",HBeginDate,HEndDate,HPlanNo,HExplanation,HInnerBillNo" +
                ",HDeptID,HQty,HEquipDotCheckRuleInterID" +
                ",HLastResult,HErrNote,HBigSafeNote,HShiftsID,HDotCheckNote" +
                ") " +
                " 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.HPlanNo + "','" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" +
               ",'" + omodel.HDeptID + "'," + omodel.HQty + "," + omodel.HEquipDotCheckRuleInterID +
               ",'" + omodel.HDeptID + "'," + omodel.HQty + "," + omodel.HEquipDotCheckRuleInterID + ",'" + omodel.HLastResult + "','" + omodel.HErrNote + "','" + omodel.HBigSafeNote + "'," + omodel.HShiftsID + ",'" + omodel.HDotCheckNote + "'" +
                ") ");
                //插入子表
                foreach (Models.ClsSb_EquipDotCheckBillSub oSub in DetailColl)
@@ -130,12 +180,13 @@
                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
                      "HDotCheckItem,HDotCheckPart,HClaim," +
                      "HManagerID,HManagerNumber,HDotCheckResult,HDotCheckItemID " +
                      ",HDotCheckItemClassID,HDotCheckItemMethodID" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() +
                      ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString()  + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim +
                      "'," + oSub.HManagerID.ToString() + ",'" + oSub.HManagerNumber + "','" + oSub.HDotCheckResult + "'," + oSub.HDotCheckItemID +
                      "'," + oSub.HManagerID.ToString() + ",'" + oSub.HManagerNumber + "','" + oSub.HDotCheckResult + "'," + oSub.HDotCheckItemID + "," + oSub.HDotCheckItemClassID + "," + oSub.HDotCheckItemMethodID +
                      ") ");
                }
                //更新点检计划子表关联标记
@@ -153,6 +204,22 @@
                //    }
                //}
                //
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Sb_EquipDotCheckBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Sb_EquipDotCheckBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;