|
|
@@ -18,6 +18,7 @@ using Dongke.IBOSS.PRD.Service.PMModuleLogic;
|
|
|
using Dongke.IBOSS.PRD.Service.SmartDeviceService;
|
|
|
using Dongke.IBOSS.PRD.WCF.Contracts;
|
|
|
using Dongke.IBOSS.PRD.WCF.DataModels;
|
|
|
+using Newtonsoft.Json.Linq;
|
|
|
|
|
|
namespace Dongke.IBOSS.PRD.WCF.Services
|
|
|
{
|
|
|
@@ -233,21 +234,134 @@ namespace Dongke.IBOSS.PRD.WCF.Services
|
|
|
/// <param name="userCode"></param>
|
|
|
/// <param name="groutingData"></param>
|
|
|
/// <returns></returns>
|
|
|
- public string AddWorkPieceKiln(string accountCode, string userCode, int procedureID, DataTable barcodeTable, out ProcedureEntity procedureInfo)
|
|
|
+ public string AddWorkPieceKiln(string accountCode, string userCode, int procedureID,string kilnCarCode, string barCodeAndPosition="")
|
|
|
{
|
|
|
- procedureInfo = null;
|
|
|
try
|
|
|
{
|
|
|
+ #region 验证用户 并配置参数 sUserInfo
|
|
|
+ DataTable userInfo = SmartDeviceLogic.CheckUserCode(accountCode, userCode);
|
|
|
+ if (userInfo == null)
|
|
|
+ {
|
|
|
+ OutputLog.TraceLog(LogPriority.Warning,
|
|
|
+ this.ToString(),
|
|
|
+ System.Reflection.MethodBase.GetCurrentMethod().Name,
|
|
|
+ " accountCode:" + accountCode + " userCode:" + userCode + " procedureID:" + procedureID ,
|
|
|
+ LocalPath.LogExePath + "SmartDevice\\");
|
|
|
+ return "EU-01";
|
|
|
+ }
|
|
|
+ SUserInfo sUserInfo = new SUserInfo();
|
|
|
+ sUserInfo.AccountID = Convert.ToInt32(userInfo.Rows[0]["AccountID"]);
|
|
|
+ sUserInfo.AccountCode = accountCode;
|
|
|
+ sUserInfo.UserID = Convert.ToInt32(userInfo.Rows[0]["userid"]);
|
|
|
+ sUserInfo.UserCode = userCode;
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 按窑车号取窑车信息
|
|
|
+ DataTable carInfo = SmartDeviceLogic.getKilnCarByCode(kilnCarCode);
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 配置参数 barcodeTable
|
|
|
+
|
|
|
+ //入窑参数
|
|
|
+ //"Barcode": "11100000012",
|
|
|
+ //"KilnCarName": "TK21",
|
|
|
+ //"KilnCode": "TK2",
|
|
|
+ //"UserCode": "F8",
|
|
|
+ //"UserID": 55,
|
|
|
+ //"UserName": "胡贤万",
|
|
|
+ //"KilnCarID": 35,
|
|
|
+ //"KilnName": "新窑炉",
|
|
|
+ //"KilnCarPosition": 2,
|
|
|
+ //"KilnCarCode": "TK21",
|
|
|
+ //"KilnID": 3
|
|
|
+ DataTable barcodeTable = new DataTable();
|
|
|
+
|
|
|
+ //入窑 卸窑 配置参数 barcodeTable
|
|
|
+ if (barCodeAndPosition == "")
|
|
|
+ {
|
|
|
+ barcodeTable.TableName = "barcodeTable";
|
|
|
+ barcodeTable.Columns.Add("UserID");
|
|
|
+ barcodeTable.Columns.Add("UserCode");
|
|
|
+ barcodeTable.Columns.Add("UserName");
|
|
|
+ barcodeTable.Columns.Add("KilnCode");
|
|
|
+ DataRow drCollectType = barcodeTable.NewRow();
|
|
|
+ drCollectType["UserID"] = userInfo.Rows[0]["UserID"].ToString();
|
|
|
+ drCollectType["UserCode"] = userInfo.Rows[0]["UserCode"].ToString();
|
|
|
+ drCollectType["UserName"] = userInfo.Rows[0]["UserName"].ToString();
|
|
|
+ drCollectType["KilnCode"] = carInfo.Rows[0]["KilnCode"].ToString();
|
|
|
+ barcodeTable.Rows.Add(drCollectType);
|
|
|
+ }
|
|
|
+
|
|
|
+ //登窑 添加数据 配置参数 barcodeTable
|
|
|
+ if (barCodeAndPosition != "")
|
|
|
+ {
|
|
|
+ barcodeTable.TableName = "barcodeTable";
|
|
|
+ barcodeTable.Columns.Add("UserID");
|
|
|
+ barcodeTable.Columns.Add("UserCode");
|
|
|
+ barcodeTable.Columns.Add("UserName");
|
|
|
+ barcodeTable.Columns.Add("BarCode");
|
|
|
+ barcodeTable.Columns.Add("KilnID");
|
|
|
+ barcodeTable.Columns.Add("KilnCode");
|
|
|
+ barcodeTable.Columns.Add("KilnName");
|
|
|
+ barcodeTable.Columns.Add("KilnCarCode");
|
|
|
+ barcodeTable.Columns.Add("KilnCarID");
|
|
|
+ barcodeTable.Columns.Add("KilnCarName");
|
|
|
+ barcodeTable.Columns.Add("KilnCarPosition");
|
|
|
+ JArray barCodeArray = JArray.Parse(barCodeAndPosition);
|
|
|
+ for(int i=0;i< barCodeArray.Count;i++)
|
|
|
+ {
|
|
|
+ DataRow drCollectType = barcodeTable.NewRow();
|
|
|
+ drCollectType["BarCode"] = barCodeArray[i]["barCode"].ToString();
|
|
|
+ drCollectType["UserID"] = userInfo.Rows[0]["UserID"].ToString();
|
|
|
+ drCollectType["UserCode"] = userInfo.Rows[0]["UserCode"].ToString();
|
|
|
+ drCollectType["UserName"] = userInfo.Rows[0]["UserName"].ToString();
|
|
|
+ drCollectType["KilnID"] = carInfo.Rows[0]["KilnID"].ToString();
|
|
|
+ drCollectType["KilnCode"] = carInfo.Rows[0]["KilnCode"].ToString();
|
|
|
+ drCollectType["KilnName"] = carInfo.Rows[0]["KilnName"].ToString();
|
|
|
+ drCollectType["KilnCarID"] = carInfo.Rows[0]["KilnCarID"].ToString();
|
|
|
+ drCollectType["KilnCarName"] = carInfo.Rows[0]["KilnCarName"].ToString();
|
|
|
+ drCollectType["KilnCarPosition"] = barCodeArray[i]["kilnCarPosition"].ToString();
|
|
|
+ barcodeTable.Rows.Add(drCollectType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 调用原始业务逻辑
|
|
|
+ ProcedureEntity procedureInfo = null;
|
|
|
ServiceResultEntity sre = SmartDeviceLogic.AddWorkPieceKiln(accountCode, userCode, procedureID, barcodeTable, out procedureInfo);
|
|
|
DataTable dt = sre.Data.Tables[0];
|
|
|
- return dt.Rows[0]["out_errMsg"].ToString();
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 输出结果
|
|
|
+ string out_msg = dt.Rows[0]["out_errMsg"].ToString();
|
|
|
+ if (dt != null && dt.Rows.Count > 0 && !string.IsNullOrWhiteSpace(out_msg))
|
|
|
+ {
|
|
|
+ OutputLog.TraceLog(LogPriority.Warning,
|
|
|
+ this.ToString(),
|
|
|
+ System.Reflection.MethodBase.GetCurrentMethod().Name + System.Environment.NewLine +
|
|
|
+ " accountCode:" + accountCode + " userCode:" + userCode + " procedureID:" + procedureID ,
|
|
|
+ JsonHelper.ToJson(dt),
|
|
|
+ LocalPath.LogExePath + "SmartDevice\\");
|
|
|
+ if (out_msg.StartsWith("无效条码"))
|
|
|
+ {
|
|
|
+ return "EP-01";
|
|
|
+ }
|
|
|
+ if (out_msg.Contains("不能到达该工序"))
|
|
|
+ {
|
|
|
+ return "EP-02";
|
|
|
+ }
|
|
|
+ return "EP-00";
|
|
|
+ }
|
|
|
+ return "OK";
|
|
|
+ #endregion
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
OutputLog.TraceLog(LogPriority.Error,
|
|
|
this.ToString(),
|
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + System.Environment.NewLine +
|
|
|
- " accountCode:" + accountCode + " userCode:" + userCode + "procedureID:"+procedureID,
|
|
|
+ " accountCode:" + accountCode + " userCode:" + userCode + "procedureID:"+ procedureID ,
|
|
|
ex.ToString(),
|
|
|
LocalPath.LogExePath);
|
|
|
return "EE";
|