chenhaozhe
2026-04-09 af78744eacb1e41ef2ba7a2e36cde3f915100ba2
WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
@@ -465,7 +465,8 @@
        /// <returns></returns>
        [Route("Sc_MESBeginWorkBill/SaveGetMESBeginWorkFrom_KS")]
        [HttpGet]
        public object SaveGetMESBeginWorkFrom_KS(string HBillType,int HSourceInterID,int HSourceEntryID,string HSourceBillNo,string user,string HSourceBillType)
        public object SaveGetMESBeginWorkFrom_KS(string HBillType,int HSourceInterID,int HSourceEntryID,
            string HSourceBillNo,string user,string HSourceBillType)
        {
         
@@ -1618,7 +1619,8 @@
        #region 报工平台快捷开工
        [Route("Sc_MESBeginWorkBill/FastBeginWorkBill")]
        [HttpGet]
        public object FastBeginWorkBill(string HBillType, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, string HSourceBillType,string user)
        public object FastBeginWorkBill(string HBillType, int HSourceInterID, int HSourceEntryID,
            string HSourceBillNo, string HSourceBillType,string user)
        {
@@ -1675,7 +1677,7 @@
                {
                    ClsSc_MESBeginWorkBillMain.HWorkShiftID = int.Parse(set.Tables[0].Rows[0]["HInterID"].ToString());
                }
                ds = oCN.RunProcReturn("select * from h_v_Cj_GetDefValByUser where 用户名称='" + user + "'", "h_v_xt_UserAssociationSelect");
                ds = oCN.RunProcReturn("select * from h_v_Cj_GetDefValByUser where 用户名称='" + user + "'", "h_v_Cj_GetDefValByUser");
                //if (ds.Tables[0].Rows[0]["HGroupID"].ToString() == "0")
                //{
@@ -1726,28 +1728,33 @@
                //保存
                //保存完毕后处理
                bool bResult = false;
                string RetHInterID = "0";
                if (oBill.omodel.HInterID == 0)
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    if(bResult)
                    {
                        RetHInterID = DBUtility.ClsPub.sExeReturnInfo;
                    }
                }
                //ds = oCN.RunProcReturn("select * from Sc_MESBeginWorkBillMain where HBillNo='" + oBill.omodel.HBillNo + "'", "Sc_MESBeginWorkBillMain");
                // ds = oCN.RunProcReturn("select * from Sc_MESBeginWorkBillMain nolock where HBillNo='" + oBill.omodel.HBillNo + "'", "Sc_MESBeginWorkBillMain");
                //if (ds.Tables[0].Rows.Count == 0)
                //{
                //    oCN.RollBack();
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "查无单据!";
                //    objJsonResult.data = 1;
                //    return objJsonResult;
                //}
                if(RetHInterID == "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查无单据!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                string sAutoCheck = oClsXt_SystemParameter.GetSingleSystemParameter("Sc_MESBeginWorkBill_AutoCheck", ref DBUtility.ClsPub.sExeReturnInfo);
                if (sAutoCheck == "Y")
                {
                    LogService.Write("开工单自动生成工作联系单...3 " + sAutoCheck);
                    if (!oBill.CheckBill(long.Parse(ds.Tables[0].Rows[0]["HInterID"].ToString()), ref DBUtility.ClsPub.sExeReturnInfo))
                    if (!oBill.CheckBill(long.Parse(RetHInterID), ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
@@ -1761,9 +1768,10 @@
                string sReturn = "";
                if (oSystemParameter.ShowBill(ref sReturn) == true)
                {
                    LogService.Write("开工单自动生成工作联系单...4 ");
                    if (oSystemParameter.omodel.WMS_CampanyName == "华舟")
                    {                       
                        LogService.Write("自动生成工作联系单..."+ oBill.omodel.HInterID);
                        LogService.Write("开工单自动生成工作联系单..."+ oBill.omodel.HInterID);
                        //自动生成工作联系单
                        ds2 = oCN.RunProcReturn("exec h_p_OA_WorkLinkBill_Create " + oBill.omodel.HInterID + "," + 3787, "h_p_OA_WorkLinkBill_Create");