chenhaozhe
8 天以前 3bb24c2bc665a8070b87aef27de7d2145ef798d3
WebAPI/Controllers/LMESController.cs
@@ -872,25 +872,39 @@
                    {
                        continue;
                    }
                    string sReturn = "";
                    if (oSystemParameter.ShowBill(ref sReturn) == true)
                    //保存前判断流转卡同一个工序派工是否排了两次
                    string SQ = "select * from Sc_ICMOBillStatus_Tmp where HSourceInterID=" + hSourceInterID + " and HSourceEntryID=" + hSourceEntryID + " and HSourceID=" + hSourceID + " and HMouldID=" + hMoldID + "";
                    ds2 = oCN.RunProcReturn(SQ, "Sc_ICMOBillStatus_Tmp");
                    if (ds2.Tables[0].Rows.Count > 0)
                    {
                         if (oSystemParameter.omodel.WMS_CampanyName == "华舟")
                         {
                            oCN.RunProc("update Sc_ProcessExchangeBillMain set HMakeDate = GETDATE(),HRemark3='已派工',HMaker='" + msg4 + "' where HInterID = " + hSourceInterID);
                            LogService.Write("自动生成工作联系单...");
                            //自动生成工作联系单
                            ds2 = oCN.RunProcReturn("exec h_p_OA_WorkLinkBill_Create " + hSourceInterID + "," + 3772, "h_p_OA_WorkLinkBill_Create");
                         }
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "同一工单不能再相同产线相同模具上重复派工!";
                        return objJsonResult;
                    }
                    //更新流转卡子表生产资源
                    oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=" + hSourceID + " where HInterID=" + hSourceInterID + " and HEntryID=" + hSourceEntryID);
                    // 插入生产状态临时表
                    string SQL = $"exec h_p_Sc_ICMOBillStatus_Tmp_PGPL {hSourceInterID},{hSourceEntryID},{hSourceID},{hMoldID}";
                    oCN.RunProc(SQL);
                    //插入工序流转卡派工单
                    string SQL1 = $"exec h_p_Sc_ProcExchSendWorkBill_PG {hSourceInterID},{hSourceEntryID},{hSourceID},{hMoldID}";
                    oCN.RunProc(SQL1);
                    string sReturn = "";
                    if (oSystemParameter.ShowBill(ref sReturn) == true)
                    {
                        if (oSystemParameter.omodel.WMS_CampanyName == "华舟")
                        {
                            oCN.RunProc("update Sc_ProcessExchangeBillMain set HMakeDate = GETDATE(),HRemark3='已派工',HMaker='" + msg4 + "' where HInterID = " + hSourceInterID);
                            LogService.Write("派工自动生成工作联系单..."+ hSourceInterID);
                            //自动生成工作联系单
                            ds2 = oCN.RunProcReturn("exec h_p_OA_WorkLinkBill_Create " + hSourceInterID + "," + 3772, "h_p_OA_WorkLinkBill_Create");
                        }
                    }
                    // 7. 提交事务
                    oCN.Commit();
@@ -2248,7 +2262,6 @@
            return GetObjectJson(ds);
        }
        /// <summary>
        /// 返回工序流转卡列表
        ///参数:string sql。
@@ -2314,6 +2327,8 @@
            }
            return GetObjectJson(ds);
        }
        #region 生产订单列表-分页
@@ -2895,73 +2910,6 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 判断下推的工序流转卡是否审核
        [Route("LEMS/ProcessExchangeBillCheck")]
        [HttpGet]
        public object ProcessExchangeBillCheck(string hmainid, string HEntryID, int OrganizationID,string HSourceBillNo)
        {
            DataSet ds;
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1  and hmainid=" + hmainid + " and  HEntryID=" + HEntryID + " order by 单据号 desc", "h_v_IF_ICMOBillList");
                string HNumber = ds.Tables[0].Rows[0]["产品代码"].ToString();
                if (ds.Tables[0].Rows[0]["审核人"].ToString() == "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "所选生产订单为未审核状态,不允许下推生成工序流转卡!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["关闭人"].ToString() != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "所选生产订单为已关闭状态,不允许下推生成工序流转卡!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["作废人"].ToString() != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "所选生产订单为已作废状态,不允许下推生成工序流转卡!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from Kf_ICStockBillSub where HInterID=" + hmainid + " and HEntryID=" + HEntryID , "Kf_ICStockBillSub");
                if (double.Parse(ds.Tables[0].Rows[0]["HSourceBillNo"].ToString()).Equals(HSourceBillNo))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "所选生产订单已全部下推,不允许再次下推!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;