1
zrg
2026-02-26 3b5467766eb37ebca6caab3af207e0ed276d4cef
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÌõÂë³öÈë¿â¼Ç¼/Kf_ICStockInOutBillController.cs
@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
@@ -106,8 +107,47 @@
            return objJsonResult;
        }
        #endregion
        #region åŒ…装容器出入库明细查询
        [Route("Kf_ICStockInOutBill/Kf_PackStockDetailQuery")]
        [HttpGet]
        public object Kf_PackStockDetailQuery(string sWhere)
        {
            List<object> columnNameList = new List<object>();
            try
            {
                string sql = "select * from h_v_Kf_PackStockDetailQuery where 1=1 " + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Kf_PackStockDetailQuery");
                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 = ds.Tables[0].Rows.Count;
                objJsonResult.Message = "获取资源绑定数据成功!";
                objJsonResult.data = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(ds.Tables[0], new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }));  //序列化DataSet中的时间格式,然后再反序列化回来
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.Message.ToString();
                objJsonResult.data = null;
                objJsonResult.list = columnNameList;
            }
            return objJsonResult;
        }
        #endregion
        #region å‡ºå…¥åº“单据条码明细查询
        [Route("Kf_ICStockInOutBill/Kf_BarCodeDetailQuery")]
        [HttpGet]
@@ -162,6 +202,74 @@
        }
        #endregion
        #region å‡ºå…¥åº“单据条码明细 è®¾ç½®æ•°æ®
        class BarCodeDetailSaveData
        {
            public long HInterID;
            public string HBillNo;
            public string HBillType;
            public string HBarCode;
            public double HMaterialJQty;
            public double HWeight_TL;
            public double HWeight_CP;
        }
        [Route("Kf_ICStockInOutBill/Kf_BarCodeDetailQuery_saveData")]
        [HttpPost]
        public json Kf_BarCodeDetailQuery_saveData([FromBody] JObject sMainSub)
        {
            try
            {
                var _value = sMainSub["msg"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString(); //子表数据
                string user = sArray[1].ToString();
                msg2 = msg2.ToString();
                List<BarCodeDetailSaveData> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<BarCodeDetailSaveData>>(msg2);
                oCN.BeginTran();
                foreach (BarCodeDetailSaveData oSub in mainList)
                {
                    long HInterID = oSub.HInterID;
                    string HBillNo = oSub.HBillNo;
                    string HBillType = oSub.HBillType;
                    string HBarCode = oSub.HBarCode;
                    double HMaterialJQty = oSub.HMaterialJQty;
                    double HWeight_TL = oSub.HWeight_TL;
                    double HWeight_CP = oSub.HWeight_CP;
                    string sql = "update Kf_ICStockBillSub_WMS set " +
                        "HMaterialJQty = " + HMaterialJQty + "" +
                        ",HWeight_TL = " + HWeight_TL + "" +
                        ",HWeight_CP = " + HWeight_CP + "" +
                        "where HInterID = " + HInterID + " " +
                        "and HBillNo = '" + HBillNo + "' " +
                        "and HBillType = '" + HBillType + "' " +
                        "and HBarCode = '" + HBarCode + "' ";
                    oCN.RunProc(sql);
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æ¡ç å‡ºå…¥åº“缓存
        #region æ¡ç å‡ºå…¥åº“缓存列表