wtt
2025-11-11 170dc25004f6d0a22add0d71fdec602545902999
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -1766,10 +1766,10 @@
        }
        #endregion
        #region 返回工序出站汇报单列表-分页
        #region 返回工序出站汇报单列表
        [Route("Cj_StationOutBill/get_Display_Eng")]
        [HttpGet]
        public object get_Display_Eng(string sWhere, string user, string Organization, int page, int size, string HBillSubType)
        public object get_Display_Eng(string sWhere, string user, string HBillSubType)
        {
            try
            {
@@ -1825,15 +1825,15 @@
                    }
                }
                //sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList_Eng " + page + "," + size + ",'" + Organization + "'," + "''", "h_p_MES_StationOutBillList_Eng");
                    ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_Eng where 1 = 1" + sWhere + "order by hmainid desc", "h_v_MES_StationOutBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList_Eng " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_MES_StationOutBillList_Eng");
                    string sql1 = "select * from h_v_MES_StationOutBillList_Eng where 1 = 1 ";
                    string sql = sql1 + sWhere + "  order by hmainid desc";
                    ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList_Eng");
                }
                //添加列名
@@ -1844,12 +1844,23 @@
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                objJsonResult.count = 1;
                objJsonResult.Message = "[0000-1-037]Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception e)
            {
@@ -2750,6 +2761,143 @@
        }
        #endregion
        #region 根据id删除出站单和关键件清单表
        [Route("Cj_StationOutBill/del_StationOutBillandAssemblyBill")]
        [HttpGet]
        public object del_StationOutBillandAssemblyBill(long HInterID, string HBarCode_P, string HDeleteMan, string HBillSubType)
        {
            try
            {
                string HComputerName = SystemInformation.ComputerName; //设备名称
                if (HBillSubType == "SUB")
                {
                    //编辑权限
                    if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Drop", 1, false, HDeleteMan))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[3791-1-001]完工单无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //编辑权限
                    if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, HDeleteMan))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[3791-1-001]出站单无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    string sReturn = "";
                    if (oSystemParameter.ShowBill(ref sReturn))
                    {
                        if (oSystemParameter.omodel.MES_StationOutBill_DeleteCtl == "Y")
                        {
                            if (oBill.omodel.HMaker != HDeleteMan && (HDeleteMan != "admin" && HDeleteMan != "Admin"))
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "[0000-1-011]只能删除本人的单据!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
                        }
                    }
                    SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                    DataSet ds;
                    //判断是否存在 相同单据号 的领料单 判断生产订单是否已结案,要求计划手工反结案
                    ds = oCn.RunProcReturn("exec h_p_MES_StationOutBill_DelCtrl  '" + oBill.omodel.HBillNo + "'", "h_p_MES_StationOutBill_DelCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[0000-2-018]判断关联失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows.Count > 0 && Pub_Class.ClsPub.isInt(ds.Tables[0].Rows[0][0]) == 2)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[0000-1-007]" + Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[0000-1-013]单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    ds = oCn.RunProcReturn($"exec h_p_DelOutInBill {HInterID},'MES_StationOutBill_DeleteRelationCtl'", "h_p_DelOutInBill");
                    if (ds.Tables[0].Rows[0][0].ToString() == "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[3791-1-002]系统参数控制,已有下道工序,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCn.BeginTran();
                    ds = oCn.RunProcReturn($"select * from Sc_AssemblyBillMain  where HMainSourceInterID={oBill.omodel.HProcExchInterID} and HMainSourceEntryID={oBill.omodel.HProcExchEntryID} and HBarCode_P='{HBarCode_P}'", "Sc_AssemblyBillMain");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        oCn.RunProc($"delete from Sc_AssemblyBillMain  where HMainSourceInterID={oBill.omodel.HProcExchInterID} and HMainSourceEntryID={oBill.omodel.HProcExchEntryID} and HBarCode_P='{HBarCode_P}'");
                        oCn.RunProc($"delete from Sc_AssemblyBillSub  where HInterID={ds.Tables[0].Rows[0]["HInterID"].ToString()} and HBarCode_P='{HBarCode_P}'");
                    }
                    oCn.RunProc("delete from Sc_StationOutBillSub_SN where HInterID=" + HInterID + " and HBarCode='" + HBarCode_P + "'");
                    oCn.RunProc($"delete from Sc_StationOutBillMain  where HInterID={HInterID}");
                    oCn.Commit();
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "[0000-1-008]删除成功!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-1-005]单据未找到!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "[0000-1-007]异常!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 编辑前判断
        [Route("Cj_StationOutBill/set_ShowBillJudge")]
        [HttpGet]
@@ -2921,7 +3069,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[0000-1-025]成功:" + j + "行,第" + (i + 1) + "行:审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }