智云SRM-WEBAPI(目前客户通用API)
yusijie
2024-02-27 ffa387e35fb64107c944508c1131046d9e6b564d
WebAPI/Controllers/BarCodeController.cs
@@ -1,4 +1,5 @@
using DBUtility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
@@ -630,6 +631,7 @@
                            bar.HMTONO = oItemSub.HMTONO;
                            bar.HSupBatchNo = oItemSub.HSupBatchNo;
                            bar.HSupMaterNumber = oItemSub.HSupMaterNumber;
                            bar.HISKFPERIOD = oItemSub.HISKFPERIOD;
                            ls2.Add(bar);
                        }
                    }
@@ -712,6 +714,7 @@
                            bar2.HMTONO = oItemSub2.HMTONO;
                            bar2.HSupBatchNo = DBUtility.ClsPub.isStrNull(oItemSub2.HSupBatchNo);
                            bar2.HSupMaterNumber = DBUtility.ClsPub.isStrNull(oItemSub2.HSupMaterNumber);
                            bar2.HISKFPERIOD = DBUtility.ClsPub.isInt(oItemSub2.HISKFPERIOD);
                            ls3.Add(bar2);
                            //LogService.Write("测试加+++" + oItemSub2.HSupID);
                        }
@@ -738,6 +741,7 @@
                string HMTONO = "";
                string HSupBatchNo = "";
                string HSupMaterNumber = "";
                Int64 HISKFPERIOD = 0;
                oCn.BeginTran();
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
@@ -768,6 +772,8 @@
                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                        HSupBatchNo = ClsPub.isStrNull(oItemSub.HSupBatchNo);
                        HSupMaterNumber = ClsPub.isStrNull(oItemSub.HSupMaterNumber);
                        HISKFPERIOD = DBUtility.ClsPub.isInt(oItemSub.HISKFPERIOD);
                        if (FCusName.Contains("夏宝"))
                        {
                            HBarCode = $"{oItemSub.HMaterID}";
@@ -775,11 +781,11 @@
                        }
                        string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                    ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO,HSupBatchNo,HSupMaterNumber " +
                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO,HSupBatchNo,HSupMaterNumber,HProduceDate,HExpiryDate,HISKFPERIOD " +
                                    ") values ("
                                    + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                    + "','" + HBatchNo + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "','" + HSupBatchNo+ "','" + HSupMaterNumber + "'" +
                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "','" + HSupBatchNo+ "','" + HSupMaterNumber + "','" + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD +
                                    ")";
                        oCn.RunProc(sql);
                        //LogService.Write(sql);
@@ -811,6 +817,7 @@
                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                        HSupBatchNo = ClsPub.isStrNull(oItemSub.HSupBatchNo);
                        HSupMaterNumber = ClsPub.isStrNull(oItemSub.HSupMaterNumber);
                        HISKFPERIOD = ClsPub.isInt(oItemSub.HISKFPERIOD);
                        if (FCusName.Contains("夏宝"))
                        {
                            HBarCode = $"{oItemSub.HMaterID}";
@@ -818,12 +825,12 @@
                        }
                        string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                    ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO ,HSupBatchNo,HSupMaterNumber" +
                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO ,HSupBatchNo,HSupMaterNumber,HProduceDate,HExpiryDate,HISKFPERIOD" +
                                    ") values ("
                                    + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                    + "','" + HBatchNo + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO +  "','" +
                                    HSupBatchNo + "','" + HSupMaterNumber + "'" + ")";
                                    HSupBatchNo + "','" + HSupMaterNumber + "','" + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
                        oCn.RunProc(sql);
                        //LogService.Write(sql);
                    }
@@ -1362,6 +1369,8 @@
        public object GetBarCodeShowList([FromBody] JObject msg)
        {
            string HSupNo = msg["HSupNo"].ToString(); string sqlWhere = msg["sqlWhere"].ToString();
            //添加列名
            List<object> columnNameList = new List<object>();
            try
            {
                string VsWhere = "";
@@ -1392,10 +1401,18 @@
                }
                else
                {
                    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列对象的列名
                    }
                    objjson.code = "0";
                    objjson.count = 10000;
                    objjson.Message = "获取成功";
                    objjson.data = ds.Tables[0];
                    objjson.list = columnNameList;
                    return objjson;
                }
            }
@@ -1704,6 +1721,7 @@
                            bar.HSupID = oItemSub.HSupID;
                            bar.HEndQty = WeiShu;
                            bar.HMTONO = oItemSub.HMTONO;
                            bar.HISKFPERIOD = oItemSub.HISKFPERIOD;
                            ls2.Add(bar);
                        }
                    }
@@ -1785,6 +1803,7 @@
                            bar2.HSupID = oItemSub2.HSupID;
                            bar2.HEndQty = WeiShu1;
                            bar2.HMTONO = oItemSub2.HMTONO;
                            bar2.HISKFPERIOD = oItemSub2.HISKFPERIOD;
                            ls3.Add(bar2);
                        }
                    }
@@ -1807,6 +1826,7 @@
                string HKFDQDate = "";
                string HWei = "";
                string HMTONO = "";
                Int64 HISKFPERIOD = 0;
                oCn.BeginTran();
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
@@ -1838,6 +1858,7 @@
                            HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
                            HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                            HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                            HISKFPERIOD = ClsPub.isInt(oItemSub.HISKFPERIOD);
                            HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                            if (FCusName.Contains("夏宝"))
                            {
@@ -1846,11 +1867,12 @@
                            }
                            string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                        ",HBatchNo,HBarcodeQtys,HBarcodeNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
                                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
                                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO,HProduceDate,HExpiryDate,HISKFPERIOD" +
                                        ") values ("
                                        + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                        + "','" + HBatchNo + "','" + SubModel.Count + "','" + count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
                                        + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
                                        + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "','"
                                        + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
                            oCn.RunProc(sql);
                            oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
                            count++;
@@ -1883,6 +1905,7 @@
                            HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                            HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                            HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                            HISKFPERIOD = ClsPub.isInt(oItemSub.HISKFPERIOD);
                            if (FCusName.Contains("夏宝"))
                            {
                                HBarCode = $"{oItemSub.HMaterID}";
@@ -1890,11 +1913,12 @@
                            }
                            string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                      ",HBatchNo,HBarcodeQtys,HBarcodeNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
                                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
                                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO,HProduceDate,HExpiryDate,HISKFPERIOD" +
                                      ") values ("
                                      + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                      + "','" + HBatchNo + "','" + SubModel.Count + "','" + _count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
                                      + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
                                      + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "','"
                                      + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
                            oCn.RunProc(sql);
                            _count++;
                        }