kazelee
2025-05-27 49efcc39ef399f8f3b170f6b06ffc2177643f1b2
api/DebugController.cs
@@ -82,13 +82,15 @@
                    //typeof(SysHelper.OI_SYS_MAXID),
                    //typeof(TN_Inbound_Order),
                    typeof(TN_Check_Detail),
                    //typeof(TN_Check_Detail),
                    //typeof(TN_Check_Order),
                    //typeof(TN_CNTR_ITEM),
                    //typeof(TN_Outbound_Detail),
                    //typeof(TN_Outbound_Order),
                    //typeof(TN_Shift_Order),
                    //typeof(TN_Shift_Detail)
                    typeof(TN_Container_Item),
                };
                using (var tran = db.Ado.UseTran()) {
@@ -203,6 +205,68 @@
                return $"Error reading CSV file: {ex.Message}";
            }
        }
        /// <summary>
        /// DEBUG:根据容器物料信息表,插入容器物料登记信息表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [Route("InsertContainerItemByCgDetail")]
        public string InsertContainerItemByCgDetail(CoverInfo _) {
            var db = new SqlHelper<object>().GetInstance();
            try {
                var cgDetailList = db.Queryable<TN_CG_Detail>().ToList();
                var cntrItemList = new List<TN_Container_Item>();
                foreach (var cgDetail in cgDetailList) {
                    if (db.Queryable<TN_Container_Item>().Where(i => i.S_CNTR_CODE == cgDetail.S_CNTR_CODE).Any()) {
                        continue;
                    }
                    cntrItemList.Add(new TN_Container_Item {
                        S_CNTR_CODE = cgDetail.S_CNTR_CODE,
                        S_ITEM_CODE = cgDetail.S_ITEM_CODE,
                    });
                }
                if (db.Insertable<TN_Container_Item>(cntrItemList).ExecuteCommand() <= 0) {
                    return "插入失败";
                }
                return "插入成功";
            }
            catch (Exception ex) {
                LogHelper.InfoEx(ex);
                return ex.Message;
            }
        }
        /// <summary>
        /// DEBUG:根据容器物料信息表,插入容器物料登记信息表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [Route("InsertContainerItem")]
        public string InsertContainerItem(InsertCntrItemInfo cgDetail) {
            var db = new SqlHelper<object>().GetInstance();
            try {
                var cntrItem = new TN_Container_Item {
                    S_CNTR_CODE = cgDetail.Cntr,
                    S_ITEM_CODE = cgDetail.Item,
                };
                if (db.Insertable<TN_Container_Item>(cntrItem).ExecuteCommand() <= 0) {
                    return "插入失败";
                }
                return "插入成功";
            }
            catch (Exception ex) {
                LogHelper.InfoEx(ex);
                return ex.Message;
            }
        }
    }
    /// <summary>
@@ -227,6 +291,11 @@
        public bool IsCover { set; get; } = false;
    }
    public class InsertCntrItemInfo {
        public string Cntr { set; get; }
        public string Item { set; get; }
    }
    /// <summary>
    /// 
    /// </summary>