wtt
2024-08-15 655238e78177677d4cb80a5b8fd2dd2e021b540e
WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
@@ -83,7 +83,7 @@
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESBeginWorkBillList_NEW  where hmainid= " + HID + " ", "h_v_Sc_MESBeginWorkBillList_NEW");
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESBeginWorkBillList_Edit  where hmainid= " + HID + " ", "h_v_Sc_MESBeginWorkBillList_Edit");
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在开工单号" };
@@ -694,10 +694,10 @@
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                else if (ds.Tables[0].Rows.Count ==1)
                else if (ds.Tables.Count ==1)
                {
                    objJsonResult.code = ds.Tables[0].Rows[0][0].ToString();
                    objJsonResult.count = 1;
                    objJsonResult.count = 0;
                    objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString();
                    objJsonResult.data = ds;
                    return objJsonResult;
@@ -735,8 +735,9 @@
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string UserName = sArray[1].ToString();
            string refSav = sArray[2].ToString();
            string msg3 = sArray[1].ToString();
            string UserName = sArray[2].ToString();
            string refSav = sArray[3].ToString();
            DBUtility.ClsPub.CurUserName = UserName;
            //保存权限
            if (!DBUtility.ClsPub.Security_Log_second("MES_MESBeginWorkBill_Edit", 1, false, DBUtility.ClsPub.CurUserName))
@@ -848,13 +849,33 @@
                    oBill.omodel = oItem;
                }
                // 表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                List<Models.ClsSc_MESBeginWorkBillSub_RelationBill> ls = new List<Models.ClsSc_MESBeginWorkBillSub_RelationBill>();
                ls = oListModels.getObjectByJson_Sc_MESBeginWorkBillSub_RelationBill(msg3);
                int i = 0;
                foreach (Models.ClsSc_MESBeginWorkBillSub_RelationBill oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;   //关闭类型
                    oBill.DetailCol2.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.omodel.HInterID == 0)
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                        bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    if (bResult)
                    {
                        objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //返回主ID
@@ -1465,6 +1486,46 @@
        #endregion
        #region  报工平台检验取样单弹窗查找数据
        [Route("Sc_MESBeginWorkBill/GetQC_TakeSampleCheckBill")]
        [HttpGet]
        public object GetQC_TakeSampleCheckBill(string HSourceInterID, string HSourceEntryID, string HSourceBillNo, string HSourceBillType)
        {
            try
            {
                //根据选择资源ID获取当前生产工单、责任人
                ds = oCN.RunProcReturn("exec h_p_GetQC_TakeSampleCheckBill @HSourceInterID=" + HSourceInterID + ",@HSourceEntryID=" + HSourceEntryID + ",@HSourceBillNo='" + HSourceBillNo + "',@HSourceBillType='" + HSourceBillType + "'", "h_p_GetQC_TakeSampleCheckBill");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取资源绑定数据成功!";
                    objJsonResult.data = ds;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "暂无资源绑定!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.Message.ToString();
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
    }