ch
2022-11-29 1bbd45a2bf28afc9da6abe335f8072cf29d78456
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -34,6 +35,7 @@
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string msg4 = sArray[2].ToString();
            string msg5 = sArray[3].ToString();
            string UserName = "";
            ListModels oListModels = new ListModels();
@@ -93,7 +95,7 @@
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.omodel.HInterID == 0)
                if (msg5 == "xz")
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
@@ -371,6 +373,53 @@
        //}
        #endregion
        #region 工序流转卡列表显示器具清单信息
        [Route("Sc_ProcessExchangeBillList/QJQD")]
        [HttpGet]
        public object QJQD(Int64 HProcExchHinteID)
        {
            try
            {
                //得到信息
                ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillQuerySub_Mould  where hmainid= " + HProcExchHinteID , "h_v_Sc_ProcessExchangeBillQuerySub_Mould");
                //写入信息
                //if (ds == null || ds.Tables[0].Rows.Count == 0)
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "未查询到出站单明细信息!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                List<object> listCol = new List<object>();
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    listCol.Add(JsonConvert.DeserializeObject(str));
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = listCol;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region[返回生产任务单明细行]
        /// <summary>
        /// 返回生产任务单明细行
@@ -500,7 +549,7 @@
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql = string.Format(@"select 流水号 HProcNo,HProcID,工序代码 HProcNumber,工序名称 HProcName,加工说明 HWorkRemark,HCenterID,工作中心代码 HCenterNumber,
                                                工作中心 HCenterName,HSupID,供应商代码 HSupNumber,供应商 HSupName,isEntrust,计划数量 HQty,加工单价 HOutPrice, 表体备注 HRemark,
                                            进站数量 HRelationQty_In,出站数量 HRelationQty_Out,委外工单数量 HRelationQty_WWOrder,不合格数量 HRelationQty_Bad,超额比例 HOverRate,
                                            进站关联数量 HRelationQty_In,出站关联数量 HRelationQty_Out,委外工单数量 HRelationQty_WWOrder,不合格数量 HRelationQty_Bad,超额比例 HOverRate,
                                            良率 HPassRate,累计良率 HSumPassRate,图纸编号 HPicNum,本工序确认记录 HProcCheckNote,工艺参数 HTechnologyParameter,HDeptID,
                                            加工车间代码 HDeptNumber,加工车间 HDeptName
                                            from h_v_Sc_ProcessExchangeBillQuerySub");
@@ -528,7 +577,7 @@
        /// <returns></returns>
        [Route("Sc_ProcessExchangeBill/DeltetProcessExchangeBillByID")]
        [HttpGet]
        public object DeltetProcessExchangeBillByID(string HInterID, string user)
        public object DeltetProcessExchangeBillByID(string HInterID,int HPRDORGID, string user)
        {
            //编辑权限
            if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Drop", 1, false, user))
@@ -551,7 +600,27 @@
                objJsonResult.data = null;
                return objJsonResult;
            }
            //删除前判断关联数量
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            DataSet ds;
            ds = oCn.RunProcReturn("select ct from (  " +
                          "  select 1 ct from Sc_StationInBillMain Where HProcExchInterID=" + lngBillKey + " " +
                          "  union all " +
                          "  select 1 from Sc_StationOutBillMain Where HProcExchInterID=" + lngBillKey + " ) as a  ", "Sc_ProcExchReportSub");
            if (ds.Tables[0].Rows.Count != 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "流转卡已经有下游进出站单后,不允许删除!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill();
            DBUtility.ClsPub.HOrgID = HPRDORGID;
            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
            {
                if (oBill.omodel.HBillStatus > 1)