chenhaozhe
2026-03-06 b8b5f197826f04a5a6a6da78699b4090626074b7
WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -57,7 +57,7 @@
        #region  工序单品不良采集 扫码查询
        [Route("Cj_SingleStation/HBardCodeList")]
        [HttpGet]
        public object HBardCodeList(string HBarCode, string user)
        public object HBardCodeList(string HBarCode,int HProcID, string user)
        {
            try
            {
@@ -71,36 +71,34 @@
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from gy_czygl WITH(NOLOCK) where czymc='" + user + "'", "gy_czygl");
                string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
                ds = oCN.RunProcReturn(@"select * from h_v_Gy_BarCodeBillHICOMProcessExchange WITH(NOLOCK) where 条码='" + HBarCode + "' ", "h_v_Gy_BarCodeBillHICOMProcessExchange");
                ds = oCN.RunProcReturn(@"select * from h_v_Gy_BarCodeBillHICOMProcessExchange WITH(NOLOCK) where 条码='" + HBarCode + "' and HProcID='"+ HProcID + "' ", "h_v_Gy_BarCodeBillHICOMProcessExchange");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "条码查无数据!";
                    objJsonResult.Message = "条码跟当前工序查无数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                int num = 0;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    if (ds.Tables[0].Rows[i]["HProcID"].ToString() == HProcID)
                    {
                        num = 1;
                    }
                }
                if (num == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "当前条码与当前工序不匹配!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //int num = 0;
                //for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                //{
                //    if (ds.Tables[0].Rows[i]["HProcID"].ToString() == HProcID)
                //    {
                //        num = 1;
                //    }
                //}
                //if (num == 0)
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "当前条码与当前工序不匹配!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (ds.Tables[0].Rows[0]["HStatus"].ToString() != "正常")
                {
@@ -308,7 +306,13 @@
            //修改条码表的状态
            oCN.RunProc("update Gy_BarCodeBill set HStatus='"+ HResult + "' where HBarCode='"+ oSub.HBarCode + "'");
            LogService.Write("类型:" + oSub.HBadTypeID + ",制单人:" + oSub.HMaker + ",制单日期:" + oSub.HMakeDate);
            //查询当前条码对应的出站单id
             ds= oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN where HBarCode='" + oSub.HBarCode + "' and HSourceEntryID='" + oSub.HProcExchEntryID + "'", "Sc_StationOutBillSub_SN");
            if (ds.Tables[0].Rows.Count > 0)
            {
                linterid= ds.Tables[0].Rows[0]["HInterID"].ToString();
            }
            LogService.Write("类型:" + oSub.HBadTypeID + ",制单人:" + oSub.HMaker + ",制单日期:" + oSub.HMakeDate  + ",工序:" + oSub.HProcID  + ",流转卡:"+ oSub.HProcExchBillNo + ",出站单id:"+ linterid);
            //修改出站单的 不良 报废数量
            if (HResult == "不良")
            {
@@ -372,8 +376,9 @@
                    if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔")
                    {
                       
                        //判断当前流转卡是否是开工
                        ds = oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus<>'0'", "Sc_ICMOBillStatus_Tmp");
                        //判断当前流转卡 当前工序是否是开工
                        ds = oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus<>'0' and HProcID='"+ HProcID + "'", "Sc_ICMOBillStatus_Tmp");
                        //查不到证明没有开工进入下一句查询
                        if (ds.Tables[0].Rows.Count == 0)
                        {
                            //判断当前流转卡是否墨西哥的
@@ -386,16 +391,20 @@
                                objJsonResult.data = null;
                                return objJsonResult;
                            }                                                 
                        }
                        }
                    }
                }
                ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
                //2026 0228斯莫尔 两道工序要合并投料 自动分配 老的 h_p_Gy_BarCodeBillBomList 用于精准查询  新的 h_p_Gy_BarCodeBillBomList2 用于查询出要全部的上料
                //ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
                ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList2 '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList2");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList");
                    //2026 0228斯莫尔 两道工序要合并投料 自动分配 老的 h_p_Sc_ProcessExchangeBillList 用于精准查询  新的 h_p_Sc_ProcessExchangeBillList2 用于查询出要全部的上料
                    //DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList");
                    DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList2 '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList2");
                    if (dataSet.Tables[0].Rows.Count > 0)
                    {
                        objJsonResult.code = "2";
@@ -3482,6 +3491,65 @@
        }
        #endregion
        #region 过站解绑列表 查询
        [Route("Cj_SingleStation/ShippingExportList")]
        [HttpGet]
        public object ShippingExportList(string sWhere, string user, string gnsy)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (gnsy != "" && gnsy != null)
                {
                    //查看权限
                    if (!DBUtility.ClsPub.Security_Log(gnsy, 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "无查看权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Cj_SingleStation_ShippingExportList" +
                        " order by 栈板码 desc,中箱码,SN码", "h_v_Cj_SingleStation_ShippingExportList");
                }
                else
                {
                    string sql1 = "select * from h_v_Cj_SingleStation_ShippingExportList where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by 栈板码 desc,中箱码,SN码";
                    ds = oCN.RunProcReturn(sql, "h_v_Cj_SingleStation_ShippingExportList");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 重工条码信息 查询
        [Route("Cj_SingleStation/UnbindBarInfo")]
        [HttpGet]
@@ -3718,6 +3786,122 @@
        }
        #endregion
        #region 小卫组托缓存 查询
        [Route("Cj_SingleStation/xiaoweizutuo_CacheList")]
        [HttpGet]
        public object xiaoweizutuo_CacheList(string sWhere, string user, string gnsy)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (gnsy != "" && gnsy != null)
                {
                    //查看权限
                    if (!DBUtility.ClsPub.Security_Log(gnsy, 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "无查看权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Sc_PackUnionBill_Temp" +
                        " order by 栈板码 desc,中箱码,SN码", "h_v_Sc_PackUnionBill_Temp");
                }
                else
                {
                    string sql1 = "select * from h_v_Sc_PackUnionBill_Temp where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by 栈板码 desc,中箱码,SN码";
                    ds = oCN.RunProcReturn(sql, "h_v_Sc_PackUnionBill_Temp");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 小卫组托缓存 删除
        /// <summary>
        ///参数:string HInterID。
        ///返回值:object。
        /// </summary>
        [Route("Cj_SingleStation/deleteBill")]
        [HttpGet]
        public object deleteBill(string HInterID, string user,string gnsy)
        {
            try
            {
                if (gnsy != "" && gnsy != null)
                {
                    //查看权限
                    if (!DBUtility.ClsPub.Security_Log(gnsy, 1, false, user))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "无查看权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (HInterID == null || HInterID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                oCN.RunProc("delete from Sc_PackUnionBill_Temp where HInterID = " + HInterID);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
    }