From 1eba75ef4ca652041fdb6c577b5a213cd1f4273a Mon Sep 17 00:00:00 2001
From: IPC-610 <IPC-610@DESKTOP-6LEOOS3>
Date: 星期一, 04 十一月 2024 08:10:30 +0800
Subject: [PATCH] 修改问题

---
 Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs |  119 +++++++++++++++++++++++
 Admin.NET/WCS.Application/Entity/WcsBoxInfo.cs   |   27 ++++
 Admin.NET/WCS.Application/PLC/PLCCommon.cs       |    3 
 Admin.NET/WCS.Application/Model/TaskRequest.cs   |  128 +++++++++++++++++++++++++
 Web/src/views/wcs/wcsTask/index.vue              |   13 +
 5 files changed, 281 insertions(+), 9 deletions(-)

diff --git a/Admin.NET/WCS.Application/Entity/WcsBoxInfo.cs b/Admin.NET/WCS.Application/Entity/WcsBoxInfo.cs
index 7d2b76e..c43cbdb 100644
--- a/Admin.NET/WCS.Application/Entity/WcsBoxInfo.cs
+++ b/Admin.NET/WCS.Application/Entity/WcsBoxInfo.cs
@@ -117,13 +117,19 @@
     /// </summary>
     [SugarColumn(ColumnName = "StoreTime", ColumnDescription = "瀛樺偍鏈熻嚦")]
     public DateTime? StoreTime { get; set; }
-    
+
+    /// <summary>
+    /// 鎶芥鏍囪
+    /// </summary>
+    [SugarColumn(ColumnName = "InsPectMark", ColumnDescription = "鎶芥鏍囪", Length = 3)]
+    public string? InsPectMark { get; set; }
+
     /// <summary>
     /// 闆剁鏍囪
     /// </summary>
     [SugarColumn(ColumnName = "BitBoxMark", ColumnDescription = "闆剁鏍囪", Length = 3)]
     public string? BitBoxMark { get; set; }
-    
+
     /// <summary>
     /// 绠辩爜
     /// </summary>
@@ -166,9 +172,22 @@
     [SugarColumn(ColumnName = "EndLotFlag", ColumnDescription = "缁撴壒鏍囪瘑", Length = 3)]
     public string? EndLotFlag { get; set; }
 
+    /// <summary>
+    /// 鎬讳欢鏁�
+    /// </summary>
+    [SugarColumn(ColumnName = "QtyCount", ColumnDescription = "鎬讳欢鏁�")]
+    public int? QtyCount { get; set; }
 
+    /// <summary>
+    /// 绗嚑浠�
+    /// </summary>
+    [SugarColumn(ColumnName = "QtyOrd", ColumnDescription = "绗嚑浠�")]
+    public int? QtyOrd { get; set; }
 
-
-
+    /// <summary>
+    /// 鐘舵��
+    /// </summary>
+    [SugarColumn(ColumnName = "Status", ColumnDescription = "鐘舵��", Length = 3)]
+    public string? Status { get; set; }
 
 }
diff --git a/Admin.NET/WCS.Application/Model/TaskRequest.cs b/Admin.NET/WCS.Application/Model/TaskRequest.cs
index fc7a5c1..105610b 100644
--- a/Admin.NET/WCS.Application/Model/TaskRequest.cs
+++ b/Admin.NET/WCS.Application/Model/TaskRequest.cs
@@ -305,3 +305,131 @@
     public List<ResponseTasksModel> TaskList { get; set; }
 }
 
+
+/// <summary>
+/// 杩斿洖璧嬬爜绯荤粺鍝嶅簲鍙傛暟
+/// </summary>
+public class ResponseFuMaModel
+{
+    /// <summary>
+    /// 鐘舵�佺爜 0鎴愬姛  -1锛氬け璐�
+    /// </summary>
+    public string Success { get; set; }
+    /// <summary>
+    /// 鎻愮ず淇℃伅
+    /// </summary>
+    public string Message { get; set; }
+}
+
+/// <summary>
+/// 璧嬬爜绯荤粺鎺ㄩ�佺鐮佷俊鎭�
+/// </summary>
+public class FumaBoxInfoInput
+{
+    /// <summary>
+    /// 绠辩爜
+    /// </summary>
+    public string BoxNo { get; set; }
+    /// <summary>
+    /// 鍗曟嵁鍙�
+    /// </summary>
+    public string OrderNo { get; set; }
+    /// <summary>
+    /// 鐗╂枡缂栫爜
+    /// </summary>
+    public string SkuNo { get; set; }
+    /// <summary>
+    /// 鐗╂枡鍚嶇О
+    /// </summary>
+    public string SkuName { get; set; }
+    /// <summary>
+    /// 鐗╂枡瑙勬牸
+    /// </summary>
+    public string Standard { get; set; }
+    /// <summary>
+    /// 鎵规鍙�
+    /// </summary>
+    public string LotNo { get; set; }
+    /// <summary>
+    /// 鏁伴噺
+    /// </summary>
+    public decimal Qty { get; set; }
+    /// <summary>
+    /// 婊$鏁伴噺
+    /// </summary>
+    public decimal FullQty { get; set; }
+    /// <summary>
+    /// 渚涜揣鍟嗘壒娆�
+    /// </summary>
+    public string SupplierLot { get; set; }
+    /// <summary>
+    /// 鏄惁鎶芥绠� 0鍚�   1鏄�
+    /// </summary>
+    public string InsPectMark { get; set; }
+    /// <summary>
+    /// 鏄惁闆剁  0鍚�   1鏄�
+    /// </summary>
+    public string BitBoxMark { get; set; }
+    /// <summary>
+    /// 璐ㄦ鐘舵�� 0寰呮锛堥粯璁わ級  1鍚堟牸  2涓嶅悎鏍�
+    /// </summary>
+    public string InspectStatus { get; set; }
+    /// <summary>
+    /// 鐢熶骇鏃ユ湡
+    /// </summary>
+    public string ProductionTime { get; set; }
+    /// <summary>
+    /// 澶辨晥鏃ユ湡
+    /// </summary>
+    public string ExpirationTime { get; set; }
+    /// <summary>
+    /// 鍌ㄥ瓨鏈熻嚦
+    /// </summary>
+    public string StoreTime { get; set; }
+    /// <summary>
+    /// 鏉ユ簮 鍥哄畾鍊糩璧嬬爜]
+    /// </summary>
+    public string Origin { get; set; }
+    /// <summary>
+    /// 缁撴壒鏍囪瘑 0/绌猴細鍚�   1锛氭槸
+    /// </summary>
+    public string EndBatchMark { get; set; }
+    /// <summary>
+    /// 绠卞唴鏄庣粏
+    /// </summary>
+    public List<BoxList> DelistList { get; set; }
+
+}
+
+public class BoxList
+{
+    /// <summary>
+    /// 鐩掔爜
+    /// </summary>
+    public string BoxNo2 { get; set; }
+    /// <summary>
+    /// 鏀爜闆嗗悎
+    /// </summary>
+    public List<BoxList2> DelistList2 { get; set; }
+}
+
+public class BoxList2
+{
+    /// <summary>
+    /// 鏀爜
+    /// </summary>
+    public string BoxNo3 { get; set; }
+    /// <summary>
+    /// 鏁伴噺
+    /// </summary>
+    public decimal Qty { get; set; }
+    /// <summary>
+    /// 鎬讳欢鏁�
+    /// </summary>
+    public int? QtyCount { get; set; }
+    /// <summary>
+    /// 绗嚑浠�
+    /// </summary>
+    public int? QtyOrd { get; set; }
+}
+
diff --git a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
index 838dae2..6de853a 100644
--- a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
+++ b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
@@ -1,4 +1,8 @@
-锘縰sing Elastic.Clients.Elasticsearch;
+锘縰sing DocumentFormat.OpenXml.Presentation;
+using Elastic.Clients.Elasticsearch;
+using Furion.Logging;
+using Newtonsoft.Json;
+using System;
 using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using System.Text;
@@ -159,4 +163,117 @@
         }
     }
 
+
+    /// <summary>
+    /// WCS鎺ュ彈璧嬬爜绯荤粺鎺ㄩ�佺殑绠辩爜淇℃伅
+    /// </summary>
+    /// <param name="models">绠辩爜淇℃伅</param>
+    /// <returns>鍙嶉淇℃伅</returns>
+    [HttpPost]
+    [AllowAnonymous]
+    public ResponseFuMaModel AddHttpBoxInfo(FumaBoxInfoInput models)
+    {
+        
+        try
+        {
+            string str = JsonConvert.SerializeObject(models);
+            Log.Information("鎺ユ敹璧嬬爜鎺ㄩ�佺殑绠辩爜淇℃伅锛�"+str);
+            if (models.Origin != "璧嬬爜")
+            {
+                throw new Exception("鏉ユ簮鏈瘑鍒�");
+            }
+            var num = _db.Queryable<WcsBoxInfo>().Where(m=>m.BoxNo == models.BoxNo && m.IsDelete == false).ToList();
+            var type = "add";
+            if (num.Count>0)
+            {
+                //WCS瀛樺湪绠辩爜淇℃伅锛屾洿鏂扮鐮佷俊鎭�(闇�鍒ゆ柇绠辩爜鏄惁宸茬粍鐩樺叆搴�)
+                var num2 = num.Count(m => m.Status != "0" || !string.IsNullOrWhiteSpace(m.PalletNo));
+                if (num2 > 0)
+                {
+                    throw new Exception("璇ョ宸插叆鐩樺叆搴擄紝涓嶅彲鏇存柊淇℃伅");
+                }
+                type = "edit";
+            }
+            
+            if (models.DelistList.Count == 0) 
+            {
+                throw new Exception("鐩掔爜闆嗗悎涓嶈兘涓虹┖");
+            }
+            
+            var listBox = new List<WcsBoxInfo>();
+            foreach (var item in models.DelistList)
+            {
+                var level = "3";
+                if (string.IsNullOrWhiteSpace(item.BoxNo2))
+                {
+                    level = "2";
+                }
+                if (item.DelistList2.Count == 0)
+                {
+                    throw new Exception("鍊肩爜闆嗗悎涓嶈兘涓虹┖");
+                }
+                //浜岀骇鐮�
+                foreach (var item2 in item.DelistList2)
+                {
+                    if (string.IsNullOrWhiteSpace(models.ProductionTime) || string.IsNullOrWhiteSpace(models.ExpirationTime))
+                    {
+                        throw new Exception("鐢熶骇鏃ユ湡鎴栧け鏁堟棩鏈熶笉鑳戒负绌�");
+                    }
+                    DateTime proTime;
+                    DateTime expTime;
+                    var isValid = DateTime.TryParse(models.ProductionTime, out proTime);
+                    var isValid2 = DateTime.TryParse(models.ExpirationTime, out expTime);
+                    if (!isValid || !isValid2)
+                    {
+                        throw new Exception("鐢熶骇鏃ユ湡鎴栧け鏁堟棩鏈熸牸寮忛敊璇�");
+                    };
+
+                    var boxAdd = new WcsBoxInfo()
+                    {
+                        BoxNo = models.BoxNo,
+                        //OrderNo = models.OrderNo,
+                        SkuNo = models.SkuNo,
+                        SkuName = models.SkuName,
+                        Standard = models.Standard,
+                        LotNo = models.LotNo,
+                        Qty = item2.Qty,
+                        FullQty = models.FullQty,
+                        //SupplierLot = models.SupplierLot,
+                        InsPectMark = models.InsPectMark,
+                        BitBoxMark = models.BitBoxMark,
+                        //InspectStatus = models.InspectStatus锛�
+                        ProductionTime = proTime,
+                        ExpirationTime = expTime,
+                        StoreTime = DateTime.Parse(models.StoreTime),
+                        EndLotFlag = string.IsNullOrWhiteSpace(models.EndBatchMark) ? "0" : models.EndBatchMark,
+
+                        BoxNo2 = item.BoxNo2,
+                        BoxNo3 = item2.BoxNo3,
+                        QtyCount = item2.QtyCount,
+                        QtyOrd = item2.QtyOrd,
+
+                        Status = "0",
+                        Level = level,
+
+                        IsDelete = false
+                    };
+                    listBox.Add(boxAdd);
+                }
+
+            }
+            _db.Insertable(listBox).ExecuteCommand();
+            if (type == "edit")
+            {
+                //gen
+                _db.Deleteable(num).ExecuteCommand();
+                return new ResponseFuMaModel() { Success = "0", Message = "鏇存柊鎴愬姛" };
+            }
+            return new ResponseFuMaModel() { Success = "0", Message = "鎻掑叆鎴愬姛" };
+        }
+        catch (Exception ex)
+        {
+            return new ResponseFuMaModel() { Success = "-1", Message = ex.Message };
+        }
+    }
+
 }
\ No newline at end of file
diff --git a/Admin.NET/WCS.Application/PLC/PLCCommon.cs b/Admin.NET/WCS.Application/PLC/PLCCommon.cs
index 2cc7b0b..9cb4230 100644
--- a/Admin.NET/WCS.Application/PLC/PLCCommon.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCCommon.cs
@@ -328,6 +328,7 @@
     /// <returns></returns>
     public static PLCUtil GetPlcIp(string startStation) 
     {
+        startStation = startStation.PadLeft(3, '0');
         string strIp = "";
         var conveyList1 = new List<string>() { "147", "145", "139", "137", "129", "127", "121", "119", "111", "109", "103", "101", "093", "091", "085", "083", "075", "073", "067", "065","033","039","044" ,"051","059"};
         var conveyList2 = new List<string>() { "205", "234", "252", "254", "260", "262", "270", "272", "278", "280", "288", "290", "294", "301", "307", "309", "315", "317", "325", "327", "331", "337" };
@@ -604,6 +605,8 @@
     /// <returns>璺烘満鑱旀満</returns>
     public static string GetRoadwayByStation(string StationNum)
     {
+        StationNum = StationNum.PadLeft(3, '0');
+
         string value = "";
         var conveyList1 = new List<string>() { "147", "145", "252", "254", "401", "402", };
         var conveyList2 = new List<string>() { "139", "137", "260", "262", "405", "406", };
diff --git a/Web/src/views/wcs/wcsTask/index.vue b/Web/src/views/wcs/wcsTask/index.vue
index 16ad7d0..91ceda3 100644
--- a/Web/src/views/wcs/wcsTask/index.vue
+++ b/Web/src/views/wcs/wcsTask/index.vue
@@ -16,7 +16,7 @@
               </el-col>
               <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
                 <el-form-item label="浠诲姟鍙�">
-                  <el-input v-model="queryParams.taskNo" clearable="" placeholder="璇疯緭鍏ヤ换鍔″彿" />
+                  <el-input v-model="queryParams.taskNo" clearable="" placeholder=" " />
                 </el-form-item>
               </el-col>
               <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
@@ -151,12 +151,12 @@
           </template>
           <el-form :model="queryParams2" ref="queryForm2" labelWidth="90">
             <el-row>
-              <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
+              <el-col :xs="24" :sm="12" :md="12" :lg="10" :xl="8" class="mb10">
                 <el-form-item label="浠诲姟鍙�">
-                  <el-input v-model="queryParams2.taskNo" clearable="" placeholder="璇疯緭鍏ヤ换鍔″彿"style="width: 130px;" />
+                  <el-input v-model="queryParams2.taskNo" clearable="" placeholder="璇疯緭鍏ヤ换鍔″彿" style="width: 130px;" />
                 </el-form-item>
               </el-col>
-              <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" style="margin-left: 20px;">
+              <el-col :xs="24" :sm="12" :md="12" :lg="10" :xl="8" class="mb10" style="margin-left: 20px;">
                 <el-form-item>
                   <el-button type="primary" icon="ele-Search" @click="handleQuery2"> 鏌ヨ
                   </el-button>
@@ -402,4 +402,9 @@
 :deep(.el-input-number) {
   width: 100%;
 }
+
+/* :deep(.el-input__inner)
+{
+  width: 50%;
+} */
 </style>

--
Gitblit v1.8.0