From 9ff424751d75ebba92f8317bd2d6aa57094baca4 Mon Sep 17 00:00:00 2001
From: chenhaozhe <gaozhechen26@gmail.com>
Date: 星期日, 08 三月 2026 19:04:38 +0800
Subject: [PATCH] 新增 投料防错 增删改查 API
---
WebAPI/Controllers/CJGL/Cj_SingleStationController.cs | 1119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 1,039 insertions(+), 80 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
index 9233cfd..f181774 100644
--- a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -7,6 +7,7 @@
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
+using WebAPI.Controllers.SCGL;
using WebAPI.Models;
namespace WebAPI.Controllers.CJGL
@@ -16,7 +17,7 @@
private json objJsonResult = new json();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
- DataSet ds;
+ DataSet ds,ds2;
#region 宸ュ簭鍗曞搧涓嶈壇閲囬泦 鐢ㄦ埛鏌ヨ鍏宠仈瀛楁
[Route("Cj_SingleStation/Cj_CollectionOfSingleProductDefectsUserList")]
@@ -57,7 +58,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 +72,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() != "姝e父")
{
@@ -308,7 +307,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 + ",鍑虹珯鍗昳d:"+ linterid);
//淇敼鍑虹珯鍗曠殑 涓嶈壇 鎶ュ簾鏁伴噺
if (HResult == "涓嶈壇")
{
@@ -372,30 +377,42 @@
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)
{
//鍒ゆ柇褰撳墠娴佽浆鍗℃槸鍚﹀ⅷ瑗垮摜鐨�
- ds = oCN.RunProcReturn("select HPRDORGID from Sc_ProcessExchangeBillMain with(nolock) where HBillNo = '" + HBarCode + "' ", "Sc_ProcessExchangeBillMain");
- if (ds.Tables[0].Rows[0]["HPRDORGID"].ToString() != "7667152")
+ ds2 = oCN.RunProcReturn("select HPRDORGID from Sc_ProcessExchangeBillMain with(nolock) where HBillNo = '" + HBarCode + "' ", "Sc_ProcessExchangeBillMain");
+ if (ds2.Tables[0].Rows[0]["HPRDORGID"].ToString() != "7667152")
{
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "[3791-2-018]鍗″彿:" + HBarCode + ",娴佽浆鍗℃湭寮�宸�!";
- objJsonResult.data = null;
- return objJsonResult;
+ //鑾峰彇鐢熶骇鐘舵�佷复鏃惰〃鏁版嵁
+ ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HProcID='" + HProcID + "'", "Sc_ICMOBillStatus_Tmp");
+ //浼犲叆 鐢熶骇鐘舵�佷复鏃惰ˉ 鍗曟嵁绫诲瀷銆佷富id銆佹簮鍗曞瓙ID銆佹簮鍗曞崟鍙枫�佸綋鍓嶇櫥褰曚汉銆佹簮鍗曞崟鎹被鍨�
+ objJsonResult = SaveMESBeginWorkFrom_ZD(ds.Tables[0].Rows[0]["HBillType"].ToString(),ds.Tables[0].Rows[0]["HInterID"].ToString(), ds.Tables[0].Rows[0]["HSourceEntryID"].ToString(), ds.Tables[0].Rows[0]["HSourceBillNo"].ToString(),user, ds.Tables[0].Rows[0]["HSourceBillType"].ToString());
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ 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";
@@ -795,8 +812,24 @@
objJsonResult.data = null;
return objJsonResult;
}
-
oCN.Commit();
+ if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) == 0)
+ {
+ //浼犲叆娴佽浆鍗� 鍗曟嵁绫诲瀷銆佷富id銆佸瓙ID銆佸崟鍙枫�佸綋鍓嶇櫥褰曚汉銆佸崟鎹被鍨�
+ objJsonResult = SaveMESEndWorkFrom_ZD("3772", HProcExchInterID, HProcExchEntryID, HProcExchBillNo, user, "");
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍑虹珯鍗曚繚瀛樻垚鍔燂紝鑷姩瀹屽伐鐢熸垚澶辫触" + objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+
+
+
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -1496,7 +1529,7 @@
sql = "delete from Sc_StationOutBillSub_SN where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
oCN.RunProc(sql);
//鍙嶅啓宸ュ簭鍑虹珯鍗曠殑鍚堟牸鏁伴噺
- oCN.RunProc("update Sc_StationOutBillMain WITH (TABLOCKX) set HQty-=1 where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID+ " and HBillNo='"+ HBillNo_bak + "'");
+ oCN.RunProc("update Sc_StationOutBillMain set HQty-=1 where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID+ " and HBillNo='"+ HBillNo_bak + "'");
oCN.Commit();
@@ -1728,11 +1761,11 @@
ds = oCN.RunProcReturn("select * from Sc_SourceLineRepairBillSub_Mater where HInterID=" + model.HInterID+ " order by HEntryID desc", "Sc_SourceLineRepairBillSub_Mater");
oCN.RunProc($@"insert into Sc_SourceLineRepairBillSub_Mater
-(HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID
-,HSourceEntryID,HSourceBillNo,HSourceBillType,HMaterID
-,HUnitID,HBarCode,HBatchNo )values
-({model.HInterID},{(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)},'{model.HBillNo}','',{temp.HProcExchInterID}
-,{temp.HProcExchEntryID},'{temp.HProcExchBillNo}','',{temp.HMaterID},0,'{temp.HBarCode}','{temp.HBatchNo}')");
+ (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID
+ ,HSourceEntryID,HSourceBillNo,HSourceBillType,HMaterID
+ ,HUnitID,HBarCode,HBatchNo )values
+ ({model.HInterID},{(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)},'{model.HBillNo}','',{temp.HProcExchInterID}
+ ,{temp.HProcExchEntryID},'{temp.HProcExchBillNo}','',{temp.HMaterID},0,'{temp.HBarCode}','{temp.HBatchNo}')");
//淇敼浜х嚎杩芥函鍗曠粦瀹氱殑鏉$爜鎵瑰彿
oCN.RunProc("update Sc_AssemblyBillSub set HBarCode='" + temp.HBarCode + "' where HInterID=" + temp.HInterID + " and HEntryID=" + temp.HEntryID);
@@ -1743,21 +1776,21 @@
model = JsonConvert.DeserializeObject<Model.ClsSc_SourceLineRepairBillMain>(sMainStr);
oCN.RunProc($@"insert into Sc_SourceLineRepairBillMain(HYear, HPeriod, HBillType, HBillSubType, HInterID,
-HDate, HBillNo, HBillStatus, HRemark, HEmpID, HDeptID, HSourceID, HProdOrgID, HMaterID, HWorkStationID,
-HProcess, HIPAddr, HMacAddr, HProdMac, HBarCode,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo)
-values('{DateTime.Now.Year}','{DateTime.Now.Month}','3748','3748',{model.HInterID}
-,getdate(),'{model.HBillNo}','1','{HResult}',{model.HEmpID},{model.HDeptID},{model.HSourceID},{model.HProdOrgID},{model.HMaterID},0
-,{model.HProcess},'','','','{model.HBarCode}','{user}',getdate(),{model.HICMOInterID},{model.HICMOEntryID},'{model.HICMOBillNo}')");
+ HDate, HBillNo, HBillStatus, HRemark, HEmpID, HDeptID, HSourceID, HProdOrgID, HMaterID, HWorkStationID,
+ HProcess, HIPAddr, HMacAddr, HProdMac, HBarCode,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo)
+ values('{DateTime.Now.Year}','{DateTime.Now.Month}','3748','3748',{model.HInterID}
+ ,getdate(),'{model.HBillNo}','1','{HResult}',{model.HEmpID},{model.HDeptID},{model.HSourceID},{model.HProdOrgID},{model.HMaterID},0
+ ,{model.HProcess},'','','','{model.HBarCode}','{user}',getdate(),{model.HICMOInterID},{model.HICMOEntryID},'{model.HICMOBillNo}')");
List<Model.ClsSc_SourceLineRepairBillSub> subLsit = new List<Model.ClsSc_SourceLineRepairBillSub>();
sMainStr = "[" + sMainStr + "]";
subLsit = JsonConvert.DeserializeObject<List<Model.ClsSc_SourceLineRepairBillSub>>(sMainStr);
oCN.RunProc($@"insert into Sc_SourceLineRepairBillSub
-(HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType
-,HBadReasonID,HBadTypeID,HBadResultID,HBadProcID,HRepairResult,HCreator,HCreateDate)
-values({model.HInterID},1,'{model.HBillNo}','',{subLsit[0].HProcExchInterID},{subLsit[0].HProcExchEntryID},'{subLsit[0].HProcExchBillNo}',''
-,{subLsit[0].HBadReasonID},{subLsit[0].HBadTypeID},{subLsit[0].HBadResultID},{model.HBadProcID},'{HResult}','{subLsit[0].HCreator}',getdate())");
+ (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType
+ ,HBadReasonID,HBadTypeID,HBadResultID,HBadProcID,HRepairResult,HCreator,HCreateDate)
+ values({model.HInterID},1,'{model.HBillNo}','{model.HRemark}',{subLsit[0].HProcExchInterID},{subLsit[0].HProcExchEntryID},'{subLsit[0].HProcExchBillNo}',''
+ ,{subLsit[0].HBadReasonID},{subLsit[0].HBadTypeID},{subLsit[0].HBadResultID},{model.HBadProcID},'{HResult}','{subLsit[0].HCreator}',getdate())");
if (HResult == "OK")
{
@@ -2437,6 +2470,340 @@
}
#endregion
+ #region 宸ュ簭鍗曞搧杩囩珯鑷姩寮�銆佸畬宸�
+ //鑷姩寮�宸�
+ public json SaveMESBeginWorkFrom_ZD(string HBillType, string HSourceInterID, string HSourceEntryID, string HSourceBillNo, string user, string HSourceBillType)
+ {
+
+
+ //淇濆瓨鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("MES_MESBeginWorkBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ try
+ {
+
+ ds = oCN.RunProcReturn("exec h_p_JIT_GetInfoByICMOStatusInterID @HSourceInterID=" + HSourceInterID + ",@HSourceEntryID=" + HSourceEntryID + ",@HSourceBillNo='" + HSourceBillNo + "',@HSourceBillType='" + HBillType + "'", "h_p_JIT_GetInfoByICMOStatusInterID");
+
+ Models.ClsSc_MESBeginWorkBillMain ClsSc_MESBeginWorkBillMain = new Models.ClsSc_MESBeginWorkBillMain();
+ ClsSc_MESBeginWorkBillMain.HProcID = int.Parse(ds.Tables[0].Rows[0]["HProcID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HMaterID = int.Parse(ds.Tables[0].Rows[0]["HMaterID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HSourceID = int.Parse(ds.Tables[0].Rows[0]["HSourceID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HMainSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
+ ClsSc_MESBeginWorkBillMain.HMainSourceInterID = int.Parse(ds.Tables[0].Rows[0]["HSourceInterID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HMainSourceEntryID = ds.Tables[0].Rows[0]["HSourceEntryID"].ToString();
+ ClsSc_MESBeginWorkBillMain.HMainSourceBillType = HSourceBillType == null ? "" : HSourceBillType;
+ ClsSc_MESBeginWorkBillMain.HDeptID = int.Parse(ds.Tables[0].Rows[0]["HDeptID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HICMOInterID = int.Parse(ds.Tables[0].Rows[0]["HICMOInterID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HICMOEntryID = int.Parse(ds.Tables[0].Rows[0]["HICMOEntryID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HICMOBillNo = ds.Tables[0].Rows[0]["HICMOBillNo"].ToString();
+ ClsSc_MESBeginWorkBillMain.HProcExchInterID = int.Parse(ds.Tables[0].Rows[0]["HProcExchInterID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HProcExchEntryID = int.Parse(ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HProcExchBillNo = ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString();
+ ClsSc_MESBeginWorkBillMain.HPeopleSum =1;
+
+ //鑾峰彇鐝
+ DataSet set = oCN.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo " + int.Parse(ds.Tables[0].Rows[0]["HDeptID"].ToString()) + "," + int.Parse(ds.Tables[0].Rows[0]["HCenterID"].ToString()), "h_p_Gy_GetWorkShiftInfo");
+ if (set.Tables[0].Rows.Count > 0)
+ {
+ ClsSc_MESBeginWorkBillMain.HWorkShiftID = int.Parse(set.Tables[0].Rows[0]["HInterID"].ToString());
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_xt_UserAssociationSelect where Czymc='" + user + "'", "h_v_xt_UserAssociationSelect");
+
+
+ if (ds.Tables[0].Rows[0]["HEmployeeID"].ToString() == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鑷姩寮�宸ヤ繚瀛樺け璐ワ紒鐢ㄦ埛娌℃湁缁戝畾鑱屽憳!";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+
+ ClsSc_MESBeginWorkBillMain.HGroupID = int.Parse(ds.Tables[0].Rows[0]["HGroupID"].ToString());
+ ClsSc_MESBeginWorkBillMain.HEmpID = int.Parse(ds.Tables[0].Rows[0]["HEmployeeID"].ToString());
+
+ DLL.ClsSc_MESBeginWorkBill oBill = new DLL.ClsSc_MESBeginWorkBill();
+ List<Models.ClsSc_MESBeginWorkBillMain> lsmain = new List<Models.ClsSc_MESBeginWorkBillMain>();
+ lsmain.Add(ClsSc_MESBeginWorkBillMain);
+ ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter();
+
+ DBUtility.ClsPub.CurUserName = user;
+
+ foreach (Models.ClsSc_MESBeginWorkBillMain oItem in lsmain)
+ {
+ oItem.HBillNo = DBUtility.ClsPub.CreateBillCode("3787", ref DBUtility.ClsPub.sExeReturnInfo, true);
+
+ oItem.HBillType = "3787";
+ oItem.HBillSubType = "3787";
+ oItem.HBillStatus = 1; //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級
+ oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+ oItem.HMaker = user;
+ oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+ oItem.HBarCodeMakeDate = Convert.ToDateTime(DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"))); //鎵弿鏃ユ湡锛堝勾-鏈�-鏃�-鏃�-鍒�-绉掞級
+ oItem.HRemark = "鑷姩寮�宸�";
+ oBill.omodel = oItem;
+ }
+
+ oCN.BeginTran();
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult = false;
+ if (oBill.omodel.HInterID == 0)
+ {
+
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+
+ }
+ ds = oCN.RunProcReturn("select * from Sc_MESBeginWorkBillMain where HBillNo='" + oBill.omodel.HBillNo + "'", "Sc_MESBeginWorkBillMain");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ユ棤鍗曟嵁!";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+ string sAutoCheck = oClsXt_SystemParameter.GetSingleSystemParameter("Sc_MESBeginWorkBill_AutoCheck", ref DBUtility.ClsPub.sExeReturnInfo);
+ if (sAutoCheck == "Y")
+ {
+
+ if (!oBill.CheckBill(long.Parse(ds.Tables[0].Rows[0]["HInterID"].ToString()), ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触!";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+
+ oCN.Commit();
+
+ if (bResult)
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = e.Message;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+
+ //鑷姩瀹屽伐
+ public json SaveMESEndWorkFrom_ZD(string HBillType, long HSourceInterID, long HSourceEntryID, string HSourceBillNo, string user, string HSourceBillType)
+ {
+
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ //淇濆瓨鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("MES_MESEndWorkBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲畬宸ュ崟淇濆瓨鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ try
+ {
+
+ ds = oCN.RunProcReturn("exec h_p_JIT_GetInfoByICMOStatusInterID @HSourceInterID=" + HSourceInterID + ",@HSourceEntryID=" + HSourceEntryID + ",@HSourceBillNo='" + HSourceBillNo + "',@HSourceBillType='" + HBillType + "'", "h_p_JIT_GetInfoByICMOStatusInterID");
+
+ Models.ClsSc_MESEndWorkBillMain ClsSc_MESEndWorkBillMain = new Models.ClsSc_MESEndWorkBillMain();
+ ClsSc_MESEndWorkBillMain.HProcID = int.Parse(ds.Tables[0].Rows[0]["HProcID"].ToString());
+ ClsSc_MESEndWorkBillMain.HMaterID = int.Parse(ds.Tables[0].Rows[0]["HMaterID"].ToString());
+ ClsSc_MESEndWorkBillMain.HSourceID = int.Parse(ds.Tables[0].Rows[0]["HSourceID"].ToString());
+ ClsSc_MESEndWorkBillMain.HMainSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
+ ClsSc_MESEndWorkBillMain.HMainSourceInterID = int.Parse(ds.Tables[0].Rows[0]["HSourceInterID"].ToString());
+ ClsSc_MESEndWorkBillMain.HMainSourceEntryID = long.Parse(ds.Tables[0].Rows[0]["HSourceEntryID"].ToString());
+ ClsSc_MESEndWorkBillMain.HMainSourceBillType = HSourceBillType == null ? "" : HSourceBillType;
+ ClsSc_MESEndWorkBillMain.HDeptID = int.Parse(ds.Tables[0].Rows[0]["HDeptID"].ToString());
+ ClsSc_MESEndWorkBillMain.HICMOInterID = int.Parse(ds.Tables[0].Rows[0]["HICMOInterID"].ToString());
+ ClsSc_MESEndWorkBillMain.HICMOEntryID = int.Parse(ds.Tables[0].Rows[0]["HICMOEntryID"].ToString());
+ ClsSc_MESEndWorkBillMain.HICMOBillNo = ds.Tables[0].Rows[0]["HICMOBillNo"].ToString();
+ ClsSc_MESEndWorkBillMain.HProcExchInterID = int.Parse(ds.Tables[0].Rows[0]["HProcExchInterID"].ToString());
+ ClsSc_MESEndWorkBillMain.HProcExchEntryID = int.Parse(ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString());
+ ClsSc_MESEndWorkBillMain.HProcExchBillNo = ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString();
+
+
+ //鑾峰彇鐝
+ DataSet set = oCN.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo " + int.Parse(ds.Tables[0].Rows[0]["HDeptID"].ToString()) + "," + int.Parse(ds.Tables[0].Rows[0]["HCenterID"].ToString()), "h_p_Gy_GetWorkShiftInfo");
+ if (set.Tables[0].Rows.Count > 0)
+ {
+ ClsSc_MESEndWorkBillMain.HWorkShiftID = int.Parse(set.Tables[0].Rows[0]["HInterID"].ToString());
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_Cj_GetDefValByUser where 鐢ㄦ埛鍚嶇О='" + user + "'", "h_v_xt_UserAssociationSelect");
+
+ if (ds.Tables[0].Rows[0]["HEmpID"].ToString() == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佺敤鎴锋病鏈夌粦瀹氳亴鍛�!";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+ ClsSc_MESEndWorkBillMain.HGroupID = int.Parse(ds.Tables[0].Rows[0]["HGroupID"].ToString());
+ ClsSc_MESEndWorkBillMain.HEmpID = int.Parse(ds.Tables[0].Rows[0]["HEmpID"].ToString());
+
+ DLL.ClsSc_MESEndWorkBill oBill = new DLL.ClsSc_MESEndWorkBill();
+ List<Models.ClsSc_MESEndWorkBillMain> lsmain = new List<Models.ClsSc_MESEndWorkBillMain>();
+ lsmain.Add(ClsSc_MESEndWorkBillMain);
+ ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter();
+
+ DBUtility.ClsPub.CurUserName = user;
+
+ foreach (Models.ClsSc_MESEndWorkBillMain oItem in lsmain)
+ {
+ oItem.HBillNo = DBUtility.ClsPub.CreateBillCode("3788", ref DBUtility.ClsPub.sExeReturnInfo, true);
+
+ oItem.HBillType = "3788";
+ oItem.HBillSubType = "3788";
+ oItem.HReportType = "3";//锛�1鏉$爜鎵弿锛�2鏈哄櫒姹囨姤锛�3鎵嬪伐褰曞叆锛�
+ oItem.HBillStatus = 1; //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級
+ oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+ oItem.HMaker = user;
+ oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+ oItem.HBarCodeMakeDate = Convert.ToDateTime(DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"))); //鎵弿鏃ユ湡锛堝勾-鏈�-鏃�-鏃�-鍒�-绉掞級
+ oItem.HRemark = "鑷姩瀹屽伐";
+ oBill.omodel = oItem;
+ }
+
+ oCN.BeginTran();
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult = false;
+ if (oBill.omodel.HInterID == 0)
+ {
+
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ if (!bResult)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+ }
+ ds = oCN.RunProcReturn("select * from Sc_MESEndWorkBillMain where HBillNo='" + oBill.omodel.HBillNo + "'", "Sc_MESEndWorkBillMain");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ユ棤鍗曟嵁!";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+ string sAutoCheck = oClsXt_SystemParameter.GetSingleSystemParameter("Sc_MESEndWorkBill_AutoCheck", ref DBUtility.ClsPub.sExeReturnInfo);
+ if (sAutoCheck == "Y")
+ {
+
+ if (!oBill.CheckBill(long.Parse(ds.Tables[0].Rows[0]["HInterID"].ToString()), ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触!";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+
+ oCN.Commit();
+
+ if (bResult)
+ {
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鑷姩瀹屽伐淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = e.Message;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+
+ #endregion
+
#region 灏忓崼鍗曞搧杩囩珯鎺ュ彛
#region 宸ュ簭鍗曞搧杩囩珯 鎵潯鐮佺爜鏍¢獙杩斿洖淇℃伅(鍙敤浜庨獙璇佹壒娆℃槸鍚﹀叆搴�)
@@ -2538,7 +2905,7 @@
}
//鏉$爜涓婇亾宸ュ簭鏄惁杩囩珯
- ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + barCode_SN + "'," + omodel.HProcID, "h_p_Sc_SNBarcodeProcCtrl_S");
+ ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_XW '" + barCode_SN + "'," + omodel.HProcID, "h_p_Sc_SNBarcodeProcCtrl_XW");
if (ClsPub.isInt(ds.Tables[0].Rows.Count) == 0)
{
objJsonResult.code = "0";
@@ -2547,7 +2914,7 @@
objJsonResult.data = null;
return objJsonResult;
}
- else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2")
+ else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -2557,17 +2924,17 @@
}
//鍒ゆ柇鏉$爜鏄惁宸茬粡鍑虹珯
- ds = oCN.RunProcReturn("select * from h_v_Gy_QualifiedRecordsList WITH(NOLOCK) where 浜у搧鏉$爜='" + barCode_SN + "' and HProcExchInterID=" + omodel.HProcExchInterID + " and HProcExchEntryID=" + omodel.HProcExchEntryID + " and HProcID=" + omodel.HProcID, "h_v_Gy_QualifiedRecordsList");
+ //ds = oCN.RunProcReturn("select * from h_v_Gy_QualifiedRecordsList WITH(NOLOCK) where 浜у搧鏉$爜='" + barCode_SN + "' and HProcExchInterID=" + omodel.HProcExchInterID + " and HProcExchEntryID=" + omodel.HProcExchEntryID + " and HProcID=" + omodel.HProcID, "h_v_Gy_QualifiedRecordsList");
- if (ds.Tables[0].Rows.Count > 0)
- {
- oCN.RollBack();
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "[0000-2-039]鏉$爜:" + barCode_SN + ",宸插嚭绔�!";
- objJsonResult.data = null;
- return objJsonResult;
- }
+ //if (ds.Tables[0].Rows.Count > 0)
+ //{
+ // oCN.RollBack();
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "[0000-2-039]鏉$爜:" + barCode_SN + ",宸插嚭绔�!";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
long HMainInterID = 0;
string BillType = "3791";
@@ -2639,7 +3006,7 @@
int HTemporaryAreaID = 0;//鏆傛斁鍖�
int HShiftsID = 0;
string HBatchNo = omodel.HBatchNo;
- string HWeight = omodel.HWeight;
+ double HWeight = omodel.HWeight;
//鑾峰彇褰撳墠鐝
//DataSet set = oCN.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo " + HDeptID + "," + HCenterID, "h_p_Gy_GetWorkShiftInfo");
//if (set.Tables[0].Rows.Count > 0)
@@ -2856,8 +3223,8 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "";
- objJsonResult.data = "娌℃湁鏌ヨ鍒版暟鎹�";
+ objJsonResult.Message = "娌℃湁鏌ヨ鍒版暟鎹�";
+ objJsonResult.data = "";
return objJsonResult;
}
@@ -2875,7 +3242,7 @@
#endregion
#region 宸ュ簭鍗曞搧杩囩珯 鍏抽敭浠剁粦瀹氶厤浠朵俊鎭复鏃跺瓨鍌�
- [Route("Cj_SingleStation/BarCodeBillBomMatch_XW")]
+ [Route("Cj_SingleStation/BarCodeBillBomBind_XW")]
[HttpGet]
public object PartsBardCode_JX(string HBillNo,string HBarCode, string HBarCode_P, int HProcID, string user, int HOrgID)
{
@@ -2937,6 +3304,130 @@
}
#endregion
+ #region 宸ュ簭鍗曞搧杩囩珯 SN闀洉鐮佹煡璇㈠叧閿欢娓呭崟(鏍规嵁娴佽浆鍗″彿)
+ [Route("Cj_SingleStation/HBardCodeBomListByHProcExch_XW")]
+ [HttpGet]
+ public object HBardCodeBomListByHProcExch_XW(string HBillNo, string HBarCode, int HProcID, int HOrgID, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "[0000-1-068]鏃犳煡璇㈡潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鏉$爜妗f涓凡鏈夋湰娆℃壂鎻忕殑鏉$爜锛屽尮閰嶇敤鏂欐竻鍗曪紙鎵爜鏁版嵁鍐欏叆涓存椂琛級
+ ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomMatchByHProcExch_XW '" + HBillNo + "','" + HBarCode + "','" + HProcID + "'," + HOrgID, "h_p_Gy_BarCodeBillBomMatchByHProcExch_XW");
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+ if (ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ objJsonResult.data = "";
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁鏌ヨ鍒版暟鎹�";
+ objJsonResult.data = "";
+ return objJsonResult;
+ }
+
+ }
+ catch (Exception e)
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "[0000-1-010]娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ュ簭鍗曞搧杩囩珯 鍏抽敭浠剁粦瀹氶厤浠朵俊鎭复鏃跺瓨鍌紙鏍规嵁娴佽浆鍗″彿锛�
+ [Route("Cj_SingleStation/BarCodeBillBomBindByHProcExch_XW")]
+ [HttpGet]
+ public object BarCodeBillBomBindByHProcExch_XW(string HBillNo, string HBarCode, string HBarCode_P, int HProcID, string user, int HOrgID)
+ {
+ try
+ {
+ //鍒ゆ柇鎵�鎵潯鐮佹槸鍚﹀瓨鍦ㄦ潯鐮佹。妗堝綋涓�
+ //ds = oCN.RunProcReturn(@"select 1 from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill");
+ //if (ds.Tables[0].Rows.Count == 0)
+ //{
+ // //鏉$爜妗f涓病鏈夋湰娆℃壂鎻忕殑鏉$爜锛屽垯鏍规嵁瑙勫垯瑙f瀽鐢熸垚鏉$爜
+
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "璇ユ潯鐮佷笉瀛樺湪锛�" + HBarCode;
+ // objJsonResult.data = "";
+ // return objJsonResult;
+
+ //}
+
+ //鏉$爜妗f涓凡鏈夋湰娆℃壂鎻忕殑鏉$爜锛屾煡璇㈤厤浠朵俊鎭紙鎵弿鏉$爜淇℃伅鍐欏叆涓存椂琛級
+ ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomBindByHProcExch_XW '" + HBillNo + "','" + HBarCode + "','" + HBarCode_P + "','" + HProcID + "','" + HOrgID + "'", "h_p_Gy_BarCodeBillBomBindByHProcExch_XW");
+
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+ if (ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ objJsonResult.data = "";
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "";
+ objJsonResult.data = "娌℃湁鏌ヨ鍒版暟鎹�";
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "ERROR锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+
#region 宸ュ簭鍗曞搧杩囩珯 鎵玈N鐮佸嚭绔欎繚瀛�(淇濆瓨鍒板嚭绔欐眹鎶ラ噷(+鍏抽敭浠剁粦瀹�))
[Route("Cj_SingleStation/AddStationOutBillAndAssemblyBill")]
[HttpPost]
@@ -2997,8 +3488,8 @@
return objJsonResult;
}
- //鏉$爜涓婇亾宸ュ簭鏄惁杩囩珯
- ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + barCode_SN + "'," + omodel.HProcID, "h_p_Sc_SNBarcodeProcCtrl_S");
+ //鏉$爜涓婇亾宸ュ簭鏄惁杩囩珯浠ュ強鏈亾鏉$爜鏄惁宸茬粡鍑虹珯
+ ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_XW '" + barCode_SN + "'," + omodel.HProcID, "h_p_Sc_SNBarcodeProcCtrl_XW");
if (ClsPub.isInt(ds.Tables[0].Rows.Count) == 0)
{
objJsonResult.code = "0";
@@ -3007,7 +3498,7 @@
objJsonResult.data = null;
return objJsonResult;
}
- else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2")
+ else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -3017,17 +3508,17 @@
}
//鍒ゆ柇鏉$爜鏄惁宸茬粡鍑虹珯
- ds = oCN.RunProcReturn("select * from h_v_Gy_QualifiedRecordsList WITH(NOLOCK) where 浜у搧鏉$爜='" + barCode_SN + "' and HProcExchInterID=" + omodel.HProcExchInterID + " and HProcExchEntryID=" + omodel.HProcExchEntryID + " and HProcID=" + omodel.HProcID, "h_v_Gy_QualifiedRecordsList");
+ //ds = oCN.RunProcReturn("select * from h_v_Gy_QualifiedRecordsList WITH(NOLOCK) where 浜у搧鏉$爜='" + barCode_SN + "' and HProcExchInterID=" + omodel.HProcExchInterID + " and HProcExchEntryID=" + omodel.HProcExchEntryID + " and HProcID=" + omodel.HProcID, "h_v_Gy_QualifiedRecordsList");
- if (ds.Tables[0].Rows.Count > 0)
- {
- oCN.RollBack();
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "[0000-2-039]鏉$爜:" + barCode_SN + ",宸插嚭绔�!";
- objJsonResult.data = null;
- return objJsonResult;
- }
+ //if (ds.Tables[0].Rows.Count > 0)
+ //{
+ // oCN.RollBack();
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "[0000-2-039]鏉$爜:" + barCode_SN + ",宸插嚭绔�!";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
//澧炲姞浜х嚎缁勮杩芥函鍗�
DataSet ds1;
@@ -3301,6 +3792,474 @@
}
}
#endregion
+
+ #region 杩囩珯瑙g粦鍒楄〃 鏌ヨ
+ [Route("Cj_SingleStation/UnbindBarList")]
+ [HttpGet]
+ public object BarList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Cj_SingleStation_UnbindBarList", 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_UnbindStation_BarList" +
+ " order by 鏉$爜鏃ユ湡 desc", "h_v_Sc_UnbindStation_BarList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Sc_UnbindStation_BarList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by 鏉$爜鏃ユ湡 desc";
+ ds = oCN.RunProcReturn(sql, "h_v_Sc_UnbindStation_BarList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ 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 杩囩珯瑙g粦鍒楄〃 鏌ヨ
+ [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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ 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]
+ public object UnbindBarInfo(string HBarCodeIDs, string user)
+ {
+ try
+ {
+ if (HBarCodeIDs == null || HBarCodeIDs.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "閲嶅伐鏉$爜淇℃伅鏈�掑叆锛岃閫�鍑洪噸璇�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ string sql = "exec h_p_Sc_UnbindBarInfo '" + HBarCodeIDs + "'";
+ ds = oCN.RunProcReturn(sql, "h_p_Sc_UnbindBarInfo");
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 瑙i櫎鍖呰鍏崇郴銆佹媶闄ょ墿鏂�(1:瑙i櫎鍖呰鍏崇郴锛�2.鎷嗛櫎鐗╂枡)
+ [Route("Cj_SingleStation/DelRelation")]
+ [HttpGet]
+ public object DelRelation(string HBarCodeIDs, Int64 HICMOInterID, Int64 HICMOEntryID, Int64 HProcID, Int64 HType, string user)
+ {
+ try
+ {
+ if (HBarCodeIDs == null || HBarCodeIDs.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎷嗛櫎鏉$爜淇℃伅鏈�掑叆锛岃閫�鍑洪噸璇�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ string sql = "exec h_p_Sc_DelbindBarRelation '" + HBarCodeIDs + "'," + HICMOInterID + "," + HICMOEntryID + "," + HProcID + "," + HType;
+ ds = oCN.RunProcReturn(sql, "h_p_Sc_DelbindBarRelation");
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() == "0")
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString();
+ objJsonResult.data = "";
+ 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/SachetBarCodeSave")]
+ [HttpGet]
+ public object SachetBarCodeSave(int HICMOInterID,int HICMOEntryID, string user)
+ {
+ try
+ {
+ //鐢熸垚鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBill", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潯鐮佺敓鎴愭潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = "exec h_p_Cj_SachetBarCodeSave " + HICMOInterID + "," + HICMOEntryID + ",'" + user + "'";
+
+ oCN.BeginTran();
+ ds = oCN.RunProcReturn(sql, "h_p_Cj_SachetBarCodeSave");
+ oCN.Commit();
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁杩斿洖鐩稿叧棣欏泭鏉$爜淇℃伅";
+ objJsonResult.data = "";
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 钃濈墮鏍囩鐢熸垚
+ [Route("Cj_SingleStation/BlueToothBarCodeSave")]
+ [HttpGet]
+ public object BlueToothBarCodeSave(string HBarCode, int HMaterID,int HOrgID ,string user)
+ {
+ try
+ {
+ //鐢熸垚鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBill", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潯鐮佺敓鎴愭潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = "exec h_p_Cj_BlueToothBarCodeSave '" + HBarCode + "'," + HMaterID + "," + HOrgID + ",'" + user + "'";
+
+ oCN.BeginTran();
+ ds = oCN.RunProcReturn(sql, "h_p_Cj_BlueToothBarCodeSave");
+ oCN.Commit();
+ if (ClsPub.isInt(ds.Tables[0].Rows.Count) == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触娌℃湁杩斿洖浠讳綍鍐呭!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "[0000-1-051]淇濆瓨澶辫触" + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "[0000-1-050]淇濆瓨鎴愬姛!";
+ objJsonResult.data = "";//
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 钃濈墮娴嬭瘯鏁版嵁鎺ュ彛
+ [Route("Cj_SingleStation/BluetoothTestDataSave")]
+ [HttpGet]
+ public object BluetoothTestDataSave(string lotSn, string testData)
+ {
+ try
+ {
+ //鍒ゆ柇鏈夋病鏈夎繃鎵撳嵃璁板綍锛堟潯鐮佹。妗堜腑瀛樹笉瀛樺湪钃濈墮mac鍦板潃锛�
+ ds = oCN.RunProcReturn("select 1 from Gy_BarCodeBill with(nolock) where HBarCode = '" + lotSn + "'", "Gy_BarCodeBill");
+ if (ds.Tables[0].Rows.Count < 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "涓婁紶鐨刲otSn锛�" + lotSn + "锛屾病鏈夋爣绛炬墦鍗拌褰曪紝璇峰厛鎵撳嵃钃濈墮mac鏍囩" ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = string.Format($@"insert into Gy_BluetoothTestData(HBluetooth_Mac,HResult,HMakeDate) values ('{lotSn}','{testData}',getdate() ) ");
+
+ oCN.RunProc(sql);//鎻掑叆钃濈墮娴嬭瘯鏁版嵁
+
+ objJsonResult.code = "success";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "钃濈墮娴嬭瘯鏁版嵁鎺ユ敹鎴愬姛锛乴otSn锛�" + lotSn;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "error";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙戠敓寮傚父锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ 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>
+ ///鍙傛暟锛歴tring 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
}
--
Gitblit v1.9.1