智云SRM-WEBAPI(目前客户通用API)
yangle
2023-04-07 2cdcaeae26ebd1b0be98b4dbb73662bb241877d3
Merge branch 'master' of http://101.37.171.70:10101/r/SRM-WEBAPI
1个文件已删除
10个文件已修改
2个文件已添加
974 ■■■■■ 已修改文件
WebAPI/Controllers/BarCodeController.cs 433 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/POInStockController.cs 357 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/POOrderController.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/WebAPIController.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Xt_grdAlignment_WMESController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/DAL.dll 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/Model.dll 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/JsonResult.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/json.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Utility/HttpHelper.cs 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/bin.7z 补丁 | 查看 | 原始文档 | blame | 历史
全部客户在运用.txt 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BarCodeController.cs
@@ -13,6 +13,8 @@
using System.Web.Script.Serialization;
using WebAPI.Code;
using WebAPI.Models;
using WebAPI.Utility;
namespace WebAPI.Controllers
{
@@ -21,7 +23,8 @@
        private JsonResult objJsonResult = new JsonResult();
        private json objjson = new json();
        public new ClsCNSRM oCn = new ClsCNSRM();
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public T ScriptDeserialize<T>(string strJson)
        {
            JavaScriptSerializer js = new JavaScriptSerializer();
@@ -494,6 +497,7 @@
        /// <returns></returns>
        public object GetBarcodeSaveBill_Box([FromBody] JObject msg)
        {
            string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
@@ -525,33 +529,9 @@
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    //if (oBill.CheckBarCode(oItemSub.HSourceInterID, oItemSub.HSourceEntryID) == false)
                    //{
                    //    objJsonResult.code = "0";
                    //    objJsonResult.count = 0;
                    //    objJsonResult.Message = "已存在条码,不允许重复生成!";
                    //    objJsonResult.data = null;
                    //    return objJsonResult;
                    //}
                    if (msg2 != string.Empty)
                    {
                        if (oItemSub.HBQty == 0 || oItemSub.HMinQty == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "内箱包装数不能为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (oItemSub.HWBQty == 0 || oItemSub.HWXQty == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "外箱包装数不能为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //数量为0 è·³è¿‡
                    if (oItemSub.HQty == 0 || oItemSub.HMinQty == 0 || oItemSub.HWXQty == 0)
                        continue;
                }
                long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
                int LSHlen = 6;             //流水号长度
@@ -733,6 +713,7 @@
                        }
                    }
                }
                string HBarCode = "";
                string HBarCodeType = "";
                Int64 HMaterID = 0;
@@ -752,6 +733,11 @@
                string HWei = "";
                string HMTONO = "";
                oCn.BeginTran();
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    //更新条码档案 è¯¥æºå•其它条码默认已经打印过一次
                    oCn.RunProc($"update Gy_BarCodeBill set  HPrintQty += 1   where HPrintQty = 0 and  HSourceInterID={oItemSub.HSourceInterID} and HSourceEntryID = {oItemSub.HSourceEntryID}");
                }
                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls2)
                {
                    //LogService.Write("循环第二次:" + oItemSub.HSupID);
@@ -774,6 +760,11 @@
                        HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                        HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                        if (FCusName.Contains("夏宝"))
                        {
                            HBarCode = $"{oItemSub.HMaterID}";
                            HBarCodeType = "品种码_外箱";
                        }
                        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 " +
@@ -809,6 +800,11 @@
                        HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                        HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                        if (FCusName.Contains("夏宝"))
                        {
                            HBarCode = $"{oItemSub.HMaterID}";
                            HBarCodeType = "品种码";
                        }
                        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 " +
@@ -873,6 +869,7 @@
        /// <returns></returns>
        public object GetBarcodeSaveBillOnlyInnerBox([FromBody] JObject msg)
        {
            string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
@@ -900,30 +897,6 @@
                List<Model.ClsGy_MaterialList_WMS_Model> ls = new List<Model.ClsGy_MaterialList_WMS_Model>();
                List<Model.ClsGy_BarCodeBill_WMS_Model> ls2 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();
                ls = oListModels.getObjectByJson_MaterialList(msg3);
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    if (CheckBarCode(oItemSub.HSourceInterID, oItemSub.HSourceEntryID) == false)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "已存在条码,不允许重复生成!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (msg2 != string.Empty)
                    {
                        if (oItemSub.HBQty == 0 || oItemSub.HMinQty == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "内箱包装数不能为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
                int LSHlen = 6;             //流水号长度
                int SumLen = 10;            //总长度
@@ -940,6 +913,20 @@
                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    //数量为0 è·³è¿‡
                    if (oItemSub.HQty == 0)
                        continue;
                    //检验打印数量(HQTY)和未打印数量
                    string sql = $"select HQty -HBarcodeCount as HNotBarcodeCount ,* from Cg_POOrderBillSub where HEntryID = {oItemSub.HSourceEntryID}";
                    DataSet ds = oCn.RunProcReturn(sql, "tables");
                    if (ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0][0]) < oItemSub.HQty)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = $"物料编码{oItemSub.HMaterNumber},本次生成条码数量不能超出未生成条码数量";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //内箱
                    if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                    {
@@ -999,6 +986,11 @@
                oCn.BeginTran();
                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls2)
                {
                    //更新条码档案 è¯¥æºå•其它条码默认已经打印过一次
                    oCn.RunProc($"update Gy_BarCodeBill set  HPrintQty += 1   where HPrintQty = 0 and  HSourceInterID={oItemSub.HSourceInterID} and HSourceEntryID = {oItemSub.HSourceEntryID}");
                }
                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls2)
                {
                    if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                    {
                        HBarCode = oItemSub.HBarCode.ToString();
@@ -1031,8 +1023,27 @@
                    }
                }
                //暂时只回填关联数量
                string _sql = "exec H_p_SRM_BarCodeBill_Update_UpdateBillRelateData " + linterid.ToString();
                oCn.RunProc(_sql);
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    if (oItemSub.HQty == 0)
                        continue;
                    //更新条码档案 è¯¥æºå•其它条码默认已经打印过一次
                    //更新 å·²æ‰“印数量
                    if (oItemSub.HSourceBillType == "1102")
                    {
                        string _HBarCodeType = "箱号条码";
                        if (FCusName.Contains("夏宝"))
                            _HBarCodeType = "品种码";
                        string sql = string.Empty;
                        sql = string.Format(@"
update t1 set
t1.HBarcodeCount =
isnull((select sum(HQty)from Gy_BarCodeBill where HSourceInterID = t1.HInterID and HSourceEntryID = t1.HEntryID and HBarCodeType ='{2}'),0)
from Cg_POOrderBillSub t1
where t1.HInterID = {0} and t1.HEntryID ={1}", oItemSub.HSourceInterID, oItemSub.HSourceEntryID, _HBarCodeType);
                        oCn.RunProc(sql);
                    }
                }
                oCn.Commit();
            }
            catch (Exception e)
@@ -1447,15 +1458,12 @@
        /// <summary>
        /// æ¡ç ç”Ÿæˆè¡¨ä½“(采购订单)
        /// </summary>
        /// <param name="sMsg"></param>
        /// <param name="sMsg">采购订单HinterID</param>
        /// <returns></returns>
        public object GetHBarCodeShowBillSubBycg(string sMsg)
        {
            try
            {
                DataSet ds;
                string s = "";
                string ShowItem = " * ";//显示的字段
                if (DBUtility.ClsPub.isLong(sMsg) == 0)
                {
                    objjson.code = "0";
@@ -1464,9 +1472,18 @@
                    objjson.data = null;
                    return objjson;
                }
                //预处理 ä¿®æ”¹é‡‡è´­è®¢å•的退料数量
                var kdTbaleName = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "DataBaseName");
                string sql = $@"update t1 set
 t1.HMrbQty = t2.FMRBQTY
 from Cg_POOrderBillSub t1
 join {kdTbaleName}..T_PUR_POORDERENTRY_R t2
 on t1.HEntryID = t2.FENTRYID
 where t1.HInterID = {sMsg} ";//sMsg é‡‡è´­è®¢å•hinterid
                oCn.RunProc(sql);
                DAL.ClsWeb_BarCodeBill oClsWeb_BarCodeBill = new DAL.ClsWeb_BarCodeBill();
                string sql = string.Format(@"select * from h_v_Cg_POOrderBillSub_ForWeb2 where HInterID = " + sMsg);
                ds = oCn.RunProcReturn(sql, "h_v_Cg_POOrderBillSub_ForWeb2");
                sql = string.Format(@"select * from h_v_Cg_POOrderBillSub_ForWeb2 where HInterID = " + sMsg);
                DataSet ds = oCn.RunProcReturn(sql, "h_v_Cg_POOrderBillSub_ForWeb2");
                //ds = oClsWeb_BarCodeBill.ShowBillSub(DBUtility.ClsPub.isLong(sMsg), ShowItem, ref DBUtility.ClsPub.sExeReturnInfo);
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
@@ -1505,11 +1522,12 @@
        /// <returns></returns>
        public object GetBarcodeSaveBillBoxBycg([FromBody] JObject msg)
        {
            string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string msg2 = sArray[0].ToString();//
            string msg3 = sArray[1].ToString();//
            string UserName = "";
            ListModels oListModels = new ListModels();
            try
@@ -1523,46 +1541,15 @@
                    UserName = oItem.HMaker;
                }
                DAL.ClsWeb_BarCodeBill oBill = new DAL.ClsWeb_BarCodeBill();
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                List<Model.ClsGy_MaterialList_WMS_Model> ls = new List<Model.ClsGy_MaterialList_WMS_Model>();
                List<Model.ClsGy_BarCodeBill_WMS_Model> ls2 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();
                List<Model.ClsGy_BarCodeBill_WMS_Model> ls3 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();
                ls = oListModels.getObjectByJson_MaterialList(msg3);
                List<Model.ClsGy_BarCodeBill_WMS_Model> ls2 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();//外箱model
                List<Model.ClsGy_BarCodeBill_WMS_Model> ls3 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();//内箱model
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    if (oBill.CheckBarCode(oItemSub.HSourceInterID, oItemSub.HSourceEntryID) == false)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "已存在条码,不允许重复生成!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (msg2 != string.Empty)
                    {
                        if (oItemSub.HBQty == 0 || oItemSub.HMinQty == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "内箱包装数不能为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (oItemSub.HWBQty == 0 || oItemSub.HWXQty == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "外箱包装数不能为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                ls = oListModels.getObjectByJson_MaterialList(msg3);//列表数据model
                long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
                int LSHlen = 6;             //流水号长度
                int SumLen = 10;            //总长度
@@ -1581,12 +1568,47 @@
                string WeiShu = ""; //尾数
                DataSet Ds;
                SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
                oCn.BeginTran();
                Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    //数量为0 è·³è¿‡
                    if (oItemSub.HQty == 0 || oItemSub.HMinQty == 0 || oItemSub.HWXQty == 0)
                        continue;
                    //检验打印数量(HQTY)和未打印数量
                    string sql = $"select HQty + isnull(HMrbQty,0) - HBarcodeCount as HNotBarcodeCount ,* from Cg_POOrderBillSub where HEntryID = {oItemSub.HSourceEntryID}";
                    DataSet ds = oCn.RunProcReturn(sql, "tables");
                    if (ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0][0]) < oItemSub.HQty)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = $"物料编码{oItemSub.HMaterNumber},本次生成条码数量不能超出未生成条码数量";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //校验批号 å’Œ ç”Ÿäº§æ—¥æœŸ
                    sql = $"select top 1 HKFDate from Gy_BarCodeBill where HSupID = '{oItemSub.HSupID}' and HBatchNo = '{oItemSub.HBatchNo.TrimStart().TrimEnd()}' and HMaterID ={oItemSub.HMaterID} and isnull(HKFDate, '') <> ''";
                    LogService.Write($"sql:{sql}");
                    DataTable dt = oCn.RunProcReturn(sql, "tables").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        LogService.Write($"HKFDate:{dt.Rows[0][0]}");
                        sql = $"select DATEDIFF(D,{dt.Rows[0][0]},{oItemSub.HKFDate})";
                        ds = oCn.RunProcReturn(sql, "tables2");
                        LogService.Write($"DATEDIFF:{Convert.ToInt32(ds.Tables[0].Rows[0][0])}");
                        if (ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0][0]) != 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = $"物料编码{oItemSub.HMaterNumber},批号{oItemSub.HBatchNo.TrimStart().TrimEnd()},生产日期为{dt.Rows[0][0]},请核对";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                    {
                        HNumber = oItemSub.HMaterID.ToString();
                        //HNumber = HNumber.Replace(".", "");
                        //HQty = Math.Ceiling(HBQty + ClsPub.isDoule(oItemSub.HWBQty));
@@ -1596,8 +1618,8 @@
                        HSumQty = ClsPub.isDoule(oItemSub.HQty);  //产品数量
                        for (int i = 0; i < HBQty; i++)
                        {
                            //  å®‰ç‘žæ¡ç è§„则:物料编码(系统代入)@物料名称(系统代入)@规格型号(系统代入)@生产日期(手工输入)@数量(手工输入)@失效日期(手工输入)@批次号(手工代入)@供应商名称(系统代入)@采购订单号(系统代入)
                            TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{oItemSub.HQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
                            ////  å®‰ç‘žæ¡ç è§„则:物料编码(系统代入)@物料名称(系统代入)@规格型号(系统代入)@生产日期(手工输入)@数量(手工输入)@失效日期(手工输入)@批次号(手工代入)@供应商名称(系统代入)@采购订单号(系统代入)
                            //TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{oItemSub.HQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
                            if (HSumQty - HMinQty > 0)
                            {
@@ -1617,7 +1639,36 @@
                                HMinQty = HSumQty;
                            }
                            //安瑞条码规则:物料编码(系统代入)@物料名称(系统代入)@规格型号(系统代入)@生产日期(手工输入)@数量(手工输入)@失效日期(手工输入)@批次号(手工代入)@供应商名称(系统代入)@采购订单号(系统代入)
                            TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{HMinQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo.TrimStart().TrimEnd()}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
                            Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
                            var HBarCode_verify = TM.Split('@'); //校验条码信息
                            var HMaterNumber_verify = HBarCode_verify[0]; //校验物料编码
                            var HMaterName_verify = HBarCode_verify[1]; //校验物料名称
                            var HMaterModel_verify = HBarCode_verify[2]; //校验规格型号
                            var HSupName_verify = HBarCode_verify[7]; //校验供应商
                            var HSourceBillNo_verify = HBarCode_verify[8]; //校验采购订单号
                            sql = $"select * from Gy_Material where HNumber = '{HMaterNumber_verify}' and HName = '{HMaterName_verify}' and HModel = '{HMaterModel_verify}'";
                            DataSet verifyMatInfo = oCn.RunProcReturn(sql, "tables");
                            sql = $"select * from Cg_POOrderBillMain where HBillNo = '{HSourceBillNo_verify}'";
                            DataSet verifyBillInfo = oCn.RunProcReturn(sql, "tables");
                            sql = $"select * from Gy_Supplier where HName = '{HSupName_verify}'";
                            DataSet verifySupInfo = oCn.RunProcReturn(sql, "tables");
                            if (verifyMatInfo.Tables[0].Rows.Count <= 0 || verifyBillInfo.Tables[0].Rows.Count <= 0 || verifySupInfo.Tables[0].Rows.Count <= 0)
                            {
                                oCn.RollBack();
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = $"条码信息校验出错,请重新生成条码";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
                            bar.HBarCode = TM;
                            bar.HMaterID = oItemSub.HMaterID;
                            //bar.HMaterNumber = oItemSub.HMaterNumber;
@@ -1644,6 +1695,7 @@
                        }
                    }
                }
                oCn.Commit();
                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub2 in ls2)
                {
                    if (ClsPub.isLong(oItemSub2.HMaterID) != 0)
@@ -1654,6 +1706,7 @@
                        int SumLen2 = 4;
                        string TM2 = "";
                        double HWXQty = 0;
                        double HBarcodeQty = ClsPub.isDoule(oItemSub2.HQty);
                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1;
                        //
@@ -1705,10 +1758,7 @@
                                TM2 = "0" + TM2;
                            }
                            bar2.HMaterID = oItemSub2.HMaterID;
                            bar2.HBarCode = oItemSub2.HBarCode + "-" + TM2;
                            bar2.HBarCode = oItemSub2.HBarCode.Replace(HBarcodeQty.ToString(), HWXQty.ToString());
                            bar2.HUnitID = oItemSub2.HUnitID;
                            bar2.HQty = HWXQty;
                            bar2.HBatchNo = DBUtility.ClsPub.isStrNull(oItemSub2.HBatchNo);
@@ -1745,68 +1795,122 @@
                string HWei = "";
                string HMTONO = "";
                oCn.BeginTran();
                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls2)
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                    //更新条码档案 è¯¥æºå•其它条码默认已经打印过一次
                    oCn.RunProc($"update Gy_BarCodeBill set  HPrintQty += 1   where HPrintQty = 0 and  HSourceInterID={oItemSub.HSourceInterID} and HSourceEntryID = {oItemSub.HSourceEntryID}");
                }
                //外箱
                var oItemSubGroup = ls2.GroupBy(x => new { x.HSourceEntryID }).Select(y => new Model.ClsGy_BarCodeBill_WMS_Model { HSourceEntryID = y.Key.HSourceEntryID });
                foreach (var oitem in oItemSubGroup)
                {
                    var SubModel = ls2.Where(x => x.HSourceEntryID == oitem.HSourceEntryID).ToList();
                    int count = 1;
                    foreach (var oItemSub in SubModel)
                    {
                        HBarCode = oItemSub.HBarCode.ToString();
                        HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
                        HBarCodeType = "箱号条码";
                        HMaterID = ClsPub.isLong(oItemSub.HMaterID);
                        HUnitID = ClsPub.isLong(oItemSub.HUnitID);
                        HQty2 = ClsPub.isDoule(oItemSub.HQty);
                        HBatchNo = ClsPub.isStrNull(oItemSub.HBatchNo);
                        HSupID = oItemSub.HSupID;
                        HKFPeriod = ClsPub.isInt(oItemSub.HKFPeriod);
                        HKFDate = ClsPub.isStrNull(oItemSub.HKFDate);
                        HKFDQDate = ClsPub.isStrNull(oItemSub.HKFDQDate);
                        HSourceInterID = ClsPub.isLong(oItemSub.HSourceInterID);
                        HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
                        HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                        HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                        oCn.RunProc("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 " +
                                    ") 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 + "')");
                        oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
                        if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                        {
                            HBarCode = oItemSub.HBarCode.ToString();
                            HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
                            HBarCodeType = "箱号条码";
                            HMaterID = ClsPub.isLong(oItemSub.HMaterID);
                            HUnitID = ClsPub.isLong(oItemSub.HUnitID);
                            HQty2 = ClsPub.isDoule(oItemSub.HQty);
                            HBatchNo = ClsPub.isStrNull(oItemSub.HBatchNo);
                            HSupID = oItemSub.HSupID;
                            HKFPeriod = ClsPub.isInt(oItemSub.HKFPeriod);
                            HKFDate = ClsPub.isStrNull(oItemSub.HKFDate);
                            HKFDQDate = ClsPub.isStrNull(oItemSub.HKFDQDate);
                            HSourceInterID = ClsPub.isLong(oItemSub.HSourceInterID);
                            HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
                            HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                            HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                            HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                            if (FCusName.Contains("夏宝"))
                            {
                                HBarCode = $"{oItemSub.HMaterID}";
                                HBarCodeType = "品种码_外箱";
                            }
                            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 " +
                                        ") 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 + "')";
                            oCn.RunProc(sql);
                            oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
                            count++;
                        }
                    }
                }
                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls3)
                //内箱
                var _oItemSubGroup = ls3.GroupBy(x => new { x.HSourceEntryID }).Select(y => new Model.ClsGy_BarCodeBill_WMS_Model { HSourceEntryID = y.Key.HSourceEntryID });
                foreach (var oitem in _oItemSubGroup)
                {
                    if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                    var SubModel = ls3.Where(x => x.HSourceEntryID == oitem.HSourceEntryID).ToList();
                    int _count = 1;
                    foreach (var oItemSub in SubModel)
                    {
                        HBarCode = oItemSub.HBarCode.ToString();
                        HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
                        HBarCodeType = "箱号内条码";
                        HMaterID = ClsPub.isLong(oItemSub.HMaterID);
                        HUnitID = ClsPub.isLong(oItemSub.HUnitID);
                        HQty2 = ClsPub.isDoule(oItemSub.HQty);
                        HBatchNo = ClsPub.isStrNull(oItemSub.HBatchNo);
                        HSupID = oItemSub.HSupID;
                        HKFPeriod = ClsPub.isInt(oItemSub.HKFPeriod);
                        HKFDate = ClsPub.isStrNull(oItemSub.HKFDate);
                        HKFDQDate = ClsPub.isStrNull(oItemSub.HKFDQDate);
                        HSourceInterID = ClsPub.isLong(oItemSub.HSourceInterID);
                        HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
                        HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                        HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                        oCn.RunProc("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 " +
                                    ") 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 + "')");
                        if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                        {
                            HBarCode = oItemSub.HBarCode.ToString();
                            HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
                            HBarCodeType = "箱号内条码";
                            HMaterID = ClsPub.isLong(oItemSub.HMaterID);
                            HUnitID = ClsPub.isLong(oItemSub.HUnitID);
                            HQty2 = ClsPub.isDoule(oItemSub.HQty);
                            HBatchNo = ClsPub.isStrNull(oItemSub.HBatchNo);
                            HSupID = oItemSub.HSupID;
                            HKFPeriod = ClsPub.isInt(oItemSub.HKFPeriod);
                            HKFDate = ClsPub.isStrNull(oItemSub.HKFDate);
                            HKFDQDate = ClsPub.isStrNull(oItemSub.HKFDQDate);
                            HSourceInterID = ClsPub.isLong(oItemSub.HSourceInterID);
                            HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
                            HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                            HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                            HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                            if (FCusName.Contains("夏宝"))
                            {
                                HBarCode = $"{oItemSub.HMaterID}";
                                HBarCodeType = "品种码";
                            }
                            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 " +
                                      ") 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 + "')";
                            oCn.RunProc(sql);
                            _count++;
                        }
                    }
                }
                //暂时只回填关联数量
                oCn.RunProc("exec H_p_SRM_BarCodeBill_Update_UpdateBillRelateData " + linterid.ToString());
                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                {
                    if (oItemSub.HQty == 0)
                        continue;
                    //更新条码档案 è¯¥æºå•其它条码默认已经打印过一次
                    //更新 å·²æ‰“印数量
                    if (oItemSub.HSourceBillType == "1102")
                    {
                        string _HBarCodeType = "箱号条码";
                        if (FCusName.Contains("夏宝"))
                            _HBarCodeType = "品种码";
                        string sql = string.Empty;
                        sql = string.Format(@"
update t1 set
t1.HBarcodeCount =
isnull((select sum(HQty)from Gy_BarCodeBill where HSourceInterID = t1.HInterID and HSourceEntryID = t1.HEntryID and HBarCodeType ='{2}'),0)
from Cg_POOrderBillSub t1
where t1.HInterID = {0} and t1.HEntryID ={1}", oItemSub.HSourceInterID, oItemSub.HSourceEntryID, _HBarCodeType);
                        oCn.RunProc(sql);
                    }
                }
                oCn.Commit();
            }
            catch (Exception e)
            {
@@ -1933,12 +2037,20 @@
        }
        [Route("DeltetBarCodeBill")]
        [HttpGet]
        public object DeltetBarCodeBill(string HInterID, string HUserName)
        [HttpPost]
        public object DeltetBarCodeBill([FromBody] JObject oData)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            try
            {
                var _value = oData["oData"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string HInter = sArray[0].ToString();
                string HInterID = HInter.Replace("\"", "");
                string HUserName = sArray[1].ToString();
                string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
                string sql = "select HItemID,HBarCode,HSourceInterID,HSourceEntryID,HQty,HBarCodeType,HSourceBillType from Gy_BarCodeBill where  HItemID in(" + HInterID + ") ";
                //LogService.Write("删除sql:" + sql);
                oCN.BeginTran();
@@ -1947,9 +2059,12 @@
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        string _HBarCodeType = "箱号条码";
                        if (FCusName.Contains("夏宝"))
                            _HBarCodeType = "品种码";
                        WebAPIController.Add_Log("条码档案删除", HUserName, "单号" + dr["HBarCode"].ToString());
                        //反写打印数量到采购订单子表
                        if (dr["HBarCodeType"].ToString() == "箱号内条码" && dr["HSourceBillType"].ToString() == "1102")
                        if (dr["HBarCodeType"].ToString() == _HBarCodeType && dr["HSourceBillType"].ToString() == "1102")
                            oCN.RunProc($"update Cg_POOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
                        //反写打印数量到委外订单
                        if (dr["HBarCodeType"].ToString() == "箱号内条码" && dr["HSourceBillType"].ToString() == "1601")
@@ -1960,7 +2075,7 @@
                        //oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
                    }
                }
                //oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + HInterID + ") ");
                oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + HInterID + ") ");
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
WebAPI/Controllers/POInStockController.cs
@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
@@ -323,7 +324,7 @@
                    oItem.HMainSourceInterID = oItem.HInterID;
                    oItem.HInterID = 0;
                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
                    if (FCusName == "安瑞医疗") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                    if (FCusName.Contains("安瑞")) //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                    {
                        if (DBUtility.ClsPub.isStrNull(oItem.HDHDate) == "")
                        {
@@ -425,6 +426,7 @@
                return objJsonResult;
            }
        }
        /// <summary>
        /// é€è´§å•列表
        /// </summary>
@@ -440,13 +442,14 @@
            string HSupNo = msg["HSupNo"].ToString(); string sqlWhere = msg["sqlWhere"].ToString();
            try
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();//开始计时
                string VsWhere = "";
                string PcWhere = "";
                SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
                DataSet ds;
                //其他过滤
                string sql = " Where hsupid in (select HSupID from h_v_Gy_UserSupplierList where ç”¨æˆ· =^^" + HSupNo.Trim() + "^^) " + sqlWhere;
                //转换特殊字符
                if (Common.SQLtoChange(sql, ref VsWhere, ref PcWhere) == false)
                {
@@ -461,13 +464,13 @@
                //获取返回数据
                ds = oCn.RunProcReturn("exec H_p_SRM_POInStockBillList '" + PcWhere + "'", "H_p_SRM_POInStockBillList");
                LogService.Write("送货单列表加载sql:exec H_p_SRM_POInStockBillList '" + PcWhere + "'");
                LogService.Write("数据查询返回" + sw.Elapsed);
                sw.Stop();//结束计时
                objjson.code = "0";
                objjson.count = 10000;
                objjson.Message = "获取成功";
                objjson.data = ds.Tables[0];
                return objjson;
            }
            catch (Exception e)
            {
@@ -614,170 +617,7 @@
                string HValue = "Y";
                if (HValue == "Y")
                {
                    if (FCusName == "瑞与祺" || FCusName == "" || FCusName.Contains("四维尔") || FCusName.Contains("凯贝奈特"))
                    {
                        sql = string.Format(@"
SELECT T3.FNAME AS FTYPENAME,M.HBILLNO,B.HINTERID,B.HENTRYID,C.FID,C.FENTRYID, D.FBILLNO,B.HQTY,CD.FRECEIVEORGID,CDOO.FNUMBER AS FRECEIVENUMBER
,D.FSUPPLIERID,DS.FNUMBER AS FSUPPLIERNUMBER,D.FPURCHASEORGID,DOO.FNUMBER AS FPURCHASEORGNUMBER,CROO.FNUMBER  AS FSETTLEORGNUMBER,
E.FPRICETIMEPOINT,E.FSETTLECURRID,EC.FNUMBER AS FSETTLECURRNUMBER,C.FMATERIALID,CM.FNUMBER AS FMATERIALNUMBER ,C.FUNITID
,CU.FNUMBER AS FUNITNUMBER,CR.FPRICE,CR.FTAXPRICE,CR.FTAXRATE,D.FPURCHASERID,isnull(T4.FNUMBER,'') AS FPURCHASERNUMBER
FROM CG_POINSTOCKBILLSUB B
JOIN CG_POINSTOCKBILLMAIN M ON B.HINTERID = M.HINTERID
JOIN {0}..T_PUR_POORDERENTRY C ON B.HSOURCEINTERID = C.FID AND B.HSOURCEENTRYID = C.FENTRYID
LEFT JOIN {0}..T_BD_MATERIAL CM ON C.FMATERIALID =CM.FMATERIALID
LEFT JOIN {0}..T_BD_UNIT CU ON C.FUNITID =CU.FUNITID
JOIN {0}..T_PUR_POORDERENTRY_D CD ON    C.FENTRYID = CD.FENTRYID
LEFT JOIN {0}..T_ORG_ORGANIZATIONS CDOO ON CD.FRECEIVEORGID = CDOO.FORGID
JOIN {0}..T_PUR_POORDERENTRY_F CR ON    C.FENTRYID = CR.FENTRYID
LEFT JOIN {0}..T_ORG_ORGANIZATIONS CROO ON CR.FSETTLEORGID = CROO.FORGID
LEFT JOIN {0}..T_PUR_POORDER D ON C.FID =D.FID
LEFT JOIN {0}..T_BAS_BILLTYPE T2 ON D.FBILLTYPEID = T2.FBILLTYPEID
LEFT JOIN {0}..T_BAS_BILLTYPE_L T3 ON T2.FBILLTYPEID = T3.FBILLTYPEID and FLOCALEID = 2052
LEFT JOIN  {0}..V_BD_BUYER T4 ON D.FPURCHASERID =T4.FID
LEFT JOIN {0}..T_BD_SUPPLIER DS ON D.FSUPPLIERID = DS.FSUPPLIERID
LEFT JOIN {0}..T_ORG_ORGANIZATIONS DOO ON D.FPURCHASEORGID = DOO.FORGID
JOIN {0}..T_PUR_POORDERFIN E ON C.FID =E.FID
LEFT JOIN {0}..T_BD_CURRENCY EC ON E. FSETTLECURRID =EC.FCURRENCYID
 WHERE b.hinterid in ({1}) and M.HERPInterID = 0
", kdTbaleName, HInterID);
                        dt = oCn.RunProcReturn(sql, "sltz").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            foreach (DataRow dr in dt.Rows)
                            {
                                //采购订单下推生成送货单 æ—¶å€™ åˆ¤æ–­æ˜¯å¦æœ‰ç”Ÿæˆé‡‡è´­è®¢å•变更单 å¦‚果有且变更单状态不为已审核 é™åˆ¶ä¸‹æŽ¨
                                objJsonResult = TestPOOrder(dr["FEntryID"].ToString());
                                if (objJsonResult.code == "0")
                                    return objJsonResult;
                            }
                            foreach (DataRow dr in dt.Rows)
                            {
                                if (fidList.Contains(dr["HINTERID"].ToString()))
                                    continue;
                                else
                                    fidList.Add(dr["HINTERID"].ToString());
                                DataRow[] drs = dt.Select("HINTERID = " + dr["HINTERID"].ToString());
                                JObject model = new JObject();
                                string fTypeName = "SLD01_SYS";//标准采购订单类型
                                string ywTypeName = "CG";//标准业务类型
                                if (dr["FTYPENAME"].ToString().Contains("委外"))
                                {
                                    fTypeName = "SLD03_SYS";
                                    ywTypeName = "WW";
                                }
                                if (dr["FTYPENAME"].ToString().Contains("资产"))
                                {
                                    fTypeName = "SLD04_SYS";
                                    ywTypeName = "ZCCG";
                                }
                                model.Add("FBILLTYPEID", new JObject() { ["Fnumber"] = fTypeName }); //单据类型
                                model.Add("FBusinessType", ywTypeName); //业务类型
                                model.Add("FBILLNO", dr["HBillNo"].ToString()); //单据编号
                                model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //通知日期
                                model.Add("FStockOrgId", new JObject() { ["Fnumber"] = dr["FRECEIVENUMBER"].ToString() }); // æ”¶æ–™ç»„织
                                model.Add("FPurOrgId", new JObject() { ["Fnumber"] = dr["FPURCHASEORGNUMBER"].ToString() }); //采购组织
                                model.Add("FSupplierId", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() }); //供应商
                                model.Add("FPURCHASERID", new JObject() { ["Fnumber"] = dr["FPURCHASERNUMBER"].ToString() }); //采购员
                                model.Add("FOwnerTypeIdHead", "BD_Supplier");//  è´§ä¸»ç±»åž‹
                                model.Add("FOwnerIdHead", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() });//货主 ä¾›åº”商
                                JArray Fentity = new JArray();
                                foreach (var item in drs)
                                {
                                    JObject FentityModel = new JObject();
                                    FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = item["FMATERIALNUMBER"].ToString() }); // ç‰©æ–™ç¼–码
                                    FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = item["FUNITNUMBER"].ToString() }); // å•位
                                    FentityModel.Add("FPreDeliveryDate", DateTime.Now.ToString("yyyy-MM-dd")); //预计到货日期
                                    FentityModel.Add("FPriceUnitId", new JObject() { ["Fnumber"] = item["FUNITNUMBER"].ToString() }); // è®¡ä»·å•位
                                    FentityModel.Add("FStockUnitID", new JObject() { ["Fnumber"] = item["FUNITNUMBER"].ToString() }); //  åº“存单位
                                    FentityModel.Add("FStockID", new JObject() { ["Fnumber"] = "BJCK-SH.01.005" }); //  åº“存单位
                                    FentityModel.Add("FActReceiveQty", Convert.ToDecimal(item["HQTY"])); // ä¾›åº”商送货数量(提料计划数量 - å·²ç”Ÿæˆé€è´§å•数量)
                                    FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");//货主类型
                                    FentityModel.Add("FOwnerID", new JObject() { ["Fnumber"] = dr["FPURCHASEORGNUMBER"].ToString() });//货主
                                    FentityModel.Add("FSrcId", item["FID"].ToString());//源单内码
                                    FentityModel.Add("FSRCFORMID", "PUR_PurchaseOrder");//源单类型
                                    FentityModel.Add("FSrcBillNo", item["FBILLNO"].ToString());//源单单号
                                    FentityModel.Add("FSRCENTRYID", item["FENTRYID"].ToString());//源单分录内码
                                    FentityModel.Add("FORDERBILLNO", item["FBILLNO"].ToString());//源单单号
                                    FentityModel.Add("FPOORDERENTRYID", item["FENTRYID"].ToString());//源单分录内码
                                    FentityModel.Add("FSRMENTRYID", item["HENTRYID"].ToString());//SRM hentryid
                                    FentityModel.Add("FPrice", item["FPRICE"].ToString());//单价
                                    FentityModel.Add("FTaxPrice", item["FTAXPRICE"].ToString());//含税单价
                                    FentityModel.Add("FEntryTaxRate", item["FTAXRATE"].ToString());//税率
                                    JArray Fentity2 = new JArray();
                                    JObject FentityModel2 = new JObject();
                                    FentityModel2.Add("FDetailEntity_Link_FRULEID", "PUR_PurchaseOrder-PUR_ReceiveBill");
                                    FentityModel2.Add("FDetailEntity_Link_FSTableName", "t_PUR_POOrderEntry");
                                    FentityModel2.Add("FDetailEntity_Link_FSBillId", item["FID"].ToString());
                                    FentityModel2.Add("FDetailEntity_Link_FSId", item["FEntryID"].ToString());
                                    Fentity2.Add(FentityModel2);
                                    FentityModel.Add("FDetailEntity_Link", Fentity2);
                                    Fentity.Add(FentityModel);
                                }
                                model.Add("FDetailEntity", Fentity); //明细信息
                                JObject _FentityModel = new JObject();
                                _FentityModel.Add("FSettleOrgId", new JObject() { ["Fnumber"] = dr["FSETTLEORGNUMBER"].ToString() }); //  ç»“算组织
                                _FentityModel.Add("FSettleCurrId", new JObject() { ["Fnumber"] = dr["FSETTLECURRNUMBER"].ToString() }); //  ç»“算币别
                                _FentityModel.Add("FPricePoint", 0); //  å®šä»·æ—¶ç‚¹
                                model.Add("FinanceEntity ", _FentityModel);//财务信息
                                JObject jsonRoot = new JObject()
                                {
                                    ["Creator"] = "",
                                    ["NeedUpDateFields"] = new JArray(),
                                    ["NeedReturnFields"] = new JArray(),
                                    ["IsDeleteEntry"] = "false",
                                    ["SubSystemId"] = "",
                                    ["IsVerifyBaseDataField"] = "false",
                                    ["Model"] = model
                                };
                                var loginRet = InvokeHelper.Login();
                                var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                                if (isSuccess == 0)
                                {
                                    objjson.code = "0";
                                    objjson.count = 0;
                                    objjson.Message = loginRet;
                                    objjson.data = null;
                                    return objjson;
                                }
                                //LogService.Write("jsonRoot:" + jsonRoot.ToString());
                                var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString());
                                //LogService.Write(result);
                                if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE")
                                {
                                    //更新送货单 ä¸»è¡¨ ERP单据号 ä»¥åŠ ERP主内玛
                                    string FBillNo = JObject.Parse(result)["Result"]["Number"].ToString();
                                    string FID = JObject.Parse(result)["Result"]["Id"].ToString();
                                    string updateSql = string.Format(@"
                                                      update a set
                                                      a.HERPInterID = {0} ,
                                                      a.HERPBillNO   ='{1}'
                                                      from Cg_POInStockBillMain a
                                                      join Cg_POInStockBillSub b on a.hinterid = b.hinterid
                                                      where b.HInterID = ({2})
                                                      and b. HSOURCEINTERID = {3}
                                                      and a.HERPInterID = 0
                                                     ", FID, FBillNo, dr["HINTERID"].ToString(), dr["FID"].ToString());
                                    oCn.RunProc(updateSql);
                                }
                                else
                                {
                                    objjson.code = "0";
                                    objjson.count = 0;
                                    objjson.Message = result;
                                    objjson.data = null;
                                    return objjson;
                                }
                            }
                        }
                        else
                        {
                            LogService.Write("收料通知单审核无数据:" + sql);
                        }
                    }
                    else if (FCusName == "夏宝电器")
                    if (FCusName == "夏宝电器")
                    {
                        sql = string.Format(@"
SELECT T3.FNAME AS FTYPENAME,M.HBILLNO,B.HINTERID,B.HENTRYID,C.FID,C.FENTRYID, D.FBILLNO,B.HQTY,CD.FRECEIVEORGID,CDOO.FNUMBER AS FRECEIVENUMBER
@@ -932,7 +772,176 @@
                            }
                        }
                    }
                    else
                    {
                        sql = string.Format(@"
SELECT T3.FNAME AS FTYPENAME,M.HBILLNO,B.HINTERID,B.HENTRYID,C.FID,C.FENTRYID, D.FBILLNO,B.HQTY,CD.FRECEIVEORGID,CDOO.FNUMBER AS FRECEIVENUMBER
,D.FSUPPLIERID,DS.FNUMBER AS FSUPPLIERNUMBER,D.FPURCHASEORGID,DOO.FNUMBER AS FPURCHASEORGNUMBER,CROO.FNUMBER  AS FSETTLEORGNUMBER,
E.FPRICETIMEPOINT,E.FSETTLECURRID,EC.FNUMBER AS FSETTLECURRNUMBER,C.FMATERIALID,CM.FNUMBER AS FMATERIALNUMBER ,C.FUNITID
,CU.FNUMBER AS FUNITNUMBER,CR.FPRICE,CR.FTAXPRICE,CR.FTAXRATE,D.FPURCHASERID,isnull(T4.FNUMBER,'') AS FPURCHASERNUMBER
FROM CG_POINSTOCKBILLSUB B
JOIN CG_POINSTOCKBILLMAIN M ON B.HINTERID = M.HINTERID
JOIN {0}..T_PUR_POORDERENTRY C ON B.HSOURCEINTERID = C.FID AND B.HSOURCEENTRYID = C.FENTRYID
LEFT JOIN {0}..T_BD_MATERIAL CM ON C.FMATERIALID =CM.FMATERIALID
LEFT JOIN {0}..T_BD_UNIT CU ON C.FUNITID =CU.FUNITID
JOIN {0}..T_PUR_POORDERENTRY_D CD ON    C.FENTRYID = CD.FENTRYID
LEFT JOIN {0}..T_ORG_ORGANIZATIONS CDOO ON CD.FRECEIVEORGID = CDOO.FORGID
JOIN {0}..T_PUR_POORDERENTRY_F CR ON    C.FENTRYID = CR.FENTRYID
LEFT JOIN {0}..T_ORG_ORGANIZATIONS CROO ON CR.FSETTLEORGID = CROO.FORGID
LEFT JOIN {0}..T_PUR_POORDER D ON C.FID =D.FID
LEFT JOIN {0}..T_BAS_BILLTYPE T2 ON D.FBILLTYPEID = T2.FBILLTYPEID
LEFT JOIN {0}..T_BAS_BILLTYPE_L T3 ON T2.FBILLTYPEID = T3.FBILLTYPEID and FLOCALEID = 2052
LEFT JOIN  {0}..V_BD_BUYER T4 ON D.FPURCHASERID =T4.FID
LEFT JOIN {0}..T_BD_SUPPLIER DS ON D.FSUPPLIERID = DS.FSUPPLIERID
LEFT JOIN {0}..T_ORG_ORGANIZATIONS DOO ON D.FPURCHASEORGID = DOO.FORGID
JOIN {0}..T_PUR_POORDERFIN E ON C.FID =E.FID
LEFT JOIN {0}..T_BD_CURRENCY EC ON E. FSETTLECURRID =EC.FCURRENCYID
 WHERE b.hinterid in ({1}) and M.HERPInterID = 0
", kdTbaleName, HInterID);
                        dt = oCn.RunProcReturn(sql, "sltz").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            foreach (DataRow dr in dt.Rows)
                            {
                                //采购订单下推生成送货单 æ—¶å€™ åˆ¤æ–­æ˜¯å¦æœ‰ç”Ÿæˆé‡‡è´­è®¢å•变更单 å¦‚果有且变更单状态不为已审核 é™åˆ¶ä¸‹æŽ¨
                                objJsonResult = TestPOOrder(dr["FEntryID"].ToString());
                                if (objJsonResult.code == "0")
                                    return objJsonResult;
                            }
                            foreach (DataRow dr in dt.Rows)
                            {
                                if (fidList.Contains(dr["HINTERID"].ToString()))
                                    continue;
                                else
                                    fidList.Add(dr["HINTERID"].ToString());
                                DataRow[] drs = dt.Select("HINTERID = " + dr["HINTERID"].ToString());
                                JObject model = new JObject();
                                string fTypeName = "SLD01_SYS";//标准采购订单类型
                                string ywTypeName = "CG";//标准业务类型
                                if (dr["FTYPENAME"].ToString().Contains("委外"))
                                {
                                    fTypeName = "SLD03_SYS";
                                    ywTypeName = "WW";
                                }
                                if (dr["FTYPENAME"].ToString().Contains("资产"))
                                {
                                    fTypeName = "SLD04_SYS";
                                    ywTypeName = "ZCCG";
                                }
                                model.Add("FBILLTYPEID", new JObject() { ["Fnumber"] = fTypeName }); //单据类型
                                model.Add("FBusinessType", ywTypeName); //业务类型
                                model.Add("FBILLNO", dr["HBillNo"].ToString()); //单据编号
                                model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //通知日期
                                model.Add("FStockOrgId", new JObject() { ["Fnumber"] = dr["FRECEIVENUMBER"].ToString() }); // æ”¶æ–™ç»„织
                                model.Add("FPurOrgId", new JObject() { ["Fnumber"] = dr["FPURCHASEORGNUMBER"].ToString() }); //采购组织
                                model.Add("FSupplierId", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() }); //供应商
                                model.Add("FPURCHASERID", new JObject() { ["Fnumber"] = dr["FPURCHASERNUMBER"].ToString() }); //采购员
                                model.Add("FOwnerTypeIdHead", "BD_Supplier");//  è´§ä¸»ç±»åž‹
                                model.Add("FOwnerIdHead", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() });//货主 ä¾›åº”商
                                JArray Fentity = new JArray();
                                foreach (var item in drs)
                                {
                                    JObject FentityModel = new JObject();
                                    FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = item["FMATERIALNUMBER"].ToString() }); // ç‰©æ–™ç¼–码
                                    FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = item["FUNITNUMBER"].ToString() }); // å•位
                                    FentityModel.Add("FPreDeliveryDate", DateTime.Now.ToString("yyyy-MM-dd")); //预计到货日期
                                    FentityModel.Add("FPriceUnitId", new JObject() { ["Fnumber"] = item["FUNITNUMBER"].ToString() }); // è®¡ä»·å•位
                                    FentityModel.Add("FStockUnitID", new JObject() { ["Fnumber"] = item["FUNITNUMBER"].ToString() }); //  åº“存单位
                                    FentityModel.Add("FStockID", new JObject() { ["Fnumber"] = "BJCK-SH.01.005" }); //  åº“存单位
                                    FentityModel.Add("FActReceiveQty", Convert.ToDecimal(item["HQTY"])); // ä¾›åº”商送货数量(提料计划数量 - å·²ç”Ÿæˆé€è´§å•数量)
                                    FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");//货主类型
                                    FentityModel.Add("FOwnerID", new JObject() { ["Fnumber"] = dr["FPURCHASEORGNUMBER"].ToString() });//货主
                                    FentityModel.Add("FSrcId", item["FID"].ToString());//源单内码
                                    FentityModel.Add("FSRCFORMID", "PUR_PurchaseOrder");//源单类型
                                    FentityModel.Add("FSrcBillNo", item["FBILLNO"].ToString());//源单单号
                                    FentityModel.Add("FSRCENTRYID", item["FENTRYID"].ToString());//源单分录内码
                                    FentityModel.Add("FORDERBILLNO", item["FBILLNO"].ToString());//源单单号
                                    FentityModel.Add("FPOORDERENTRYID", item["FENTRYID"].ToString());//源单分录内码
                                    FentityModel.Add("FSRMENTRYID", item["HENTRYID"].ToString());//SRM hentryid
                                    FentityModel.Add("FPrice", item["FPRICE"].ToString());//单价
                                    FentityModel.Add("FTaxPrice", item["FTAXPRICE"].ToString());//含税单价
                                    FentityModel.Add("FEntryTaxRate", item["FTAXRATE"].ToString());//税率
                                    JArray Fentity2 = new JArray();
                                    JObject FentityModel2 = new JObject();
                                    FentityModel2.Add("FDetailEntity_Link_FRULEID", "PUR_PurchaseOrder-PUR_ReceiveBill");
                                    FentityModel2.Add("FDetailEntity_Link_FSTableName", "t_PUR_POOrderEntry");
                                    FentityModel2.Add("FDetailEntity_Link_FSBillId", item["FID"].ToString());
                                    FentityModel2.Add("FDetailEntity_Link_FSId", item["FEntryID"].ToString());
                                    Fentity2.Add(FentityModel2);
                                    FentityModel.Add("FDetailEntity_Link", Fentity2);
                                    Fentity.Add(FentityModel);
                                }
                                model.Add("FDetailEntity", Fentity); //明细信息
                                JObject _FentityModel = new JObject();
                                _FentityModel.Add("FSettleOrgId", new JObject() { ["Fnumber"] = dr["FSETTLEORGNUMBER"].ToString() }); //  ç»“算组织
                                _FentityModel.Add("FSettleCurrId", new JObject() { ["Fnumber"] = dr["FSETTLECURRNUMBER"].ToString() }); //  ç»“算币别
                                _FentityModel.Add("FPricePoint", 0); //  å®šä»·æ—¶ç‚¹
                                model.Add("FinanceEntity ", _FentityModel);//财务信息
                                JObject jsonRoot = new JObject()
                                {
                                    ["Creator"] = "",
                                    ["NeedUpDateFields"] = new JArray(),
                                    ["NeedReturnFields"] = new JArray(),
                                    ["IsDeleteEntry"] = "false",
                                    ["SubSystemId"] = "",
                                    ["IsVerifyBaseDataField"] = "false",
                                    ["Model"] = model
                                };
                                var loginRet = InvokeHelper.Login();
                                var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                                if (isSuccess == 0)
                                {
                                    objjson.code = "0";
                                    objjson.count = 0;
                                    objjson.Message = loginRet;
                                    objjson.data = null;
                                    return objjson;
                                }
                                //LogService.Write("jsonRoot:" + jsonRoot.ToString());
                                var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString());
                                //LogService.Write(result);
                                if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE")
                                {
                                    //更新送货单 ä¸»è¡¨ ERP单据号 ä»¥åŠ ERP主内玛
                                    string FBillNo = JObject.Parse(result)["Result"]["Number"].ToString();
                                    string FID = JObject.Parse(result)["Result"]["Id"].ToString();
                                    string updateSql = string.Format(@"
                                                      update a set
                                                      a.HERPInterID = {0} ,
                                                      a.HERPBillNO   ='{1}'
                                                      from Cg_POInStockBillMain a
                                                      join Cg_POInStockBillSub b on a.hinterid = b.hinterid
                                                      where b.HInterID = ({2})
                                                      and b. HSOURCEINTERID = {3}
                                                      and a.HERPInterID = 0
                                                     ", FID, FBillNo, dr["HINTERID"].ToString(), dr["FID"].ToString());
                                    oCn.RunProc(updateSql);
                                }
                                else
                                {
                                    objjson.code = "0";
                                    objjson.count = 0;
                                    objjson.Message = result;
                                    objjson.data = null;
                                    return objjson;
                                }
                            }
                        }
                        else
                        {
                            LogService.Write("收料通知单审核无数据:" + sql);
                        }
                    }
                }
                ////更新物流字段 ï¼ˆç‘žä¸Žçªï¼‰
                //oCn.RunProc("exec h_p_Cg_LocalToKingDee_POInStock " + HBillNo + "," + HInterID);
                //更新主表状态 å®¡æ ¸
                sql = string.Format(@"update Cg_POInStockBillMain set 
HBillStatus = 2 ,
@@ -981,8 +990,8 @@
            SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
            int HInterID = 0;
            string sql = "select HInterID from CG_POINSTOCKBILLMAIN where HBILLNO = '" + HBillNo + "'";
            if (type == "Print")
                sql += " and HBillStatus = '2' ";//打印判断是否审核
            //if (type == "Print")
            //    sql += " and HBillStatus = '2' ";//打印判断是否审核
            DataTable dt = oCn.RunProcReturn(sql, "HInterID").Tables[0];
            if (dt.Rows.Count > 0)
                HInterID = Convert.ToInt32(dt.Rows[0]["HInterID"]);
@@ -1189,17 +1198,19 @@
                    var HinterID = mylist[i].ToString();
                    oCn.RunProc($"exec h_p_SRM_UpDatePPBomRelationQty {HinterID}");
                }
                //判断未关联数量是否为0
                DataSet ds = oCn.RunProcReturn($"select * from H_v_SRM_POOrderBillList where hsubid in ({string.Join(", ", entryList)}) ", "H_v_SRM_POOrderBillList");
                //安瑞:AIS20220914133941   ç‘žä¸Žçªï¼šAIS20220308151944
                DataSet ds = oCn.RunProcReturn($"select T1.hqty-T1.hrelationqty+q.FMRBQTY as hqty,单据号,物料编码 from H_v_SRM_POOrderBillList t1 left join AIS20220914133941..T_PUR_POORDERENTRY_R q on q.FENTRYID=t1.HEntryID  where hentryid in ({string.Join(", ", entryList)}) ", "H_v_SRM_POOrderBillList");
                DataTable dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataRow[] dr = dt.Select("未关联数量 = " + 0);
                    DataRow[] dr = dt.Select("hqty  <=" + 0);
                    if (dr.Count() > 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = $"请检查数据,单据号:{dr[0]["单据号"]},物料代码:{dr[0]["物料代码"]},未关联数量为0,已全部生成送货单!";
                        objJsonResult.Message = $"请检查数据,单据号:{dr[0]["单据号"]},物料编码:{dr[0]["物料编码"]},可以发货数量为0,已全部生成送货单!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
WebAPI/Controllers/POOrderController.cs
@@ -1,4 +1,5 @@
using DBUtility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
@@ -53,15 +54,25 @@
                //获取总行数
                //Int64 RowTotal = Common.GetRowTotal("H_v_SRM_POOrderBillList", VsWhere, ref DBUtility.ClsPub.sExeReturnInfo);
                //获取返回数据
                //sql = "exec H_P_REALESEPOORDER";
                //sql = "exec H_P_REALESEPOORDER";
                //oCn.RunProc(sql);
                sql = "exec H_p_SRM_POOrderBillList '" + PcWhere + "'";
                //LogService.WriteAsync(sql);
                ds = oCn.RunProcReturn("exec H_p_SRM_POOrderBillList '" + PcWhere + "'", "H_p_SRM_POOrderBillList");
                //添加列名
                List<object> columnNameList = new List<object>();
                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;
            }
WebAPI/Controllers/WebAPIController.cs
@@ -15,6 +15,7 @@
using System.Web.Http;
using WebAPI.BLL;
using WebAPI.Models;
using WebAPI.Utility;
namespace WebAPI.Controllers
{
@@ -845,6 +846,29 @@
            return objjson; ;
        }
        #endregion
        #region[打印idSession]
        [Route("linteridSession")]
        [HttpPost]
        public object linteridSession([FromBody] JObject linterid)
        {
            var _linterid = linterid["linterid"].ToString();
            var _huserName = linterid["HUserName"].ToString();
            var postMesseege = _linterid + ";" + _huserName;
            //HttpHelper.PostData("http://localhost:8082/ZYMES/layuiAdmin.std-v1.2.1/src/views/SRM/Api/SRM_Web_PoBarCodeBillApi.ashx", postMesseege);
            HttpHelper.PostData("http://60.191.21.115:9090/layuiAdmin.std-v1.2.1/src/views/SRM/Api/SRM_Web_PoBarCodeBillApi.ashx", postMesseege);
            SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
            string sql = $"Update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0) + 1  where HItemID in ({_linterid})";
            oCn.RunProc(sql);
            objJsonResult.code = "0";
            objJsonResult.count = 0;
            objJsonResult.Message = "";
            objJsonResult.data = 1;
            return objJsonResult;
            //HttpContext.Current.Session["linterid"];
        }
        #endregion
    }
WebAPI/Controllers/Xt_grdAlignment_WMESController.cs
@@ -108,7 +108,7 @@
                {
                    var width = omdelsub[i].ColumnWidth;
                    if (string.IsNullOrEmpty(width) || DBUtility.ClsPub.isLong(width) == 0)
                        width = "120";
                        width = "80";
                    HGridString += $"{(i+1)}|{(omdelsub[i].IsHide == true ? 1 : 0)}|{omdelsub[i].Alignment}|{width},";
                }
                HGridString = HGridString.Substring(0, HGridString.Length - 1);
WebAPI/DLL/DAL.dll
Binary files differ
WebAPI/DLL/Model.dll
Binary files differ
WebAPI/Models/JsonResult.cs
@@ -11,5 +11,7 @@
        public int count { get; set; }
        public string Message { get; set; }
        public object data { get; set; }
        public List<object> list { get; set; }
    }
}
WebAPI/Models/json.cs
@@ -11,5 +11,7 @@
        public int count { get; set; }
        public string Message { get; set; }
        public object data { get; set; }
        public List<object> list { get; set; }
    }
}
WebAPI/Utility/HttpHelper.cs
New file
@@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace WebAPI.Utility
{
    public class HttpHelper
    {
        public static string PostData(string url, string postData)
        {
            ASCIIEncoding encoding = new ASCIIEncoding();
            byte[] data = Encoding.UTF8.GetBytes(postData);
            HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
            myRequest.Method = "POST";
            myRequest.ContentType = "application/x-www-form-urlencoded";
            myRequest.ContentLength = data.Length;
            Stream newStream = myRequest.GetRequestStream();
            newStream.Write(data, 0, data.Length);
            newStream.Close();
            HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
            StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
            string content = reader.ReadToEnd();
            reader.Close();
            return content;
        }
        public static string GetData(string url)
        {
            HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
            myRequest.Method = "GET";
            HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
            StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
            string content = reader.ReadToEnd();
            reader.Close();
            return content;
        }
        /// <summary>
        /// FORM表单POST方式上传一个多媒体文件
        /// </summary>
        /// <param name="url">API URL</param>
        /// <param name="typeName"></param>
        /// <param name="fileName"></param>
        /// <param name="fs"></param>
        /// <param name="encoding"></param>
        /// <returns></returns>
        public static string HttpRequestPost(string url, string typeName, string fileName, Stream fs, string encoding = "UTF-8")
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "POST";
            request.Timeout = 10000;
            var postStream = new MemoryStream();
            #region å¤„理Form表单文件上传
            //通过表单上传文件
            string boundary = "----" + DateTime.Now.Ticks.ToString("x");
            string formdataTemplate = "\r\n--" + boundary + "\r\nContent-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: application/octet-stream\r\n\r\n";
            try
            {
                var formdata = string.Format(formdataTemplate, typeName, fileName);
                var formdataBytes = Encoding.ASCII.GetBytes(postStream.Length == 0 ? formdata.Substring(2, formdata.Length - 2) : formdata);//第一行不需要换行
                postStream.Write(formdataBytes, 0, formdataBytes.Length);
                //写入文件
                byte[] buffer = new byte[1024];
                int bytesRead = 0;
                while ((bytesRead = fs.Read(buffer, 0, buffer.Length)) != 0)
                {
                    postStream.Write(buffer, 0, bytesRead);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //结尾
            var footer = Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
            postStream.Write(footer, 0, footer.Length);
            request.ContentType = string.Format("multipart/form-data; boundary={0}", boundary);
            #endregion
            request.ContentLength = postStream != null ? postStream.Length : 0;
            request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
            request.KeepAlive = true;
            request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36";
            #region è¾“入二进制流
            if (postStream != null)
            {
                postStream.Position = 0;
                //直接写入流
                Stream requestStream = request.GetRequestStream();
                byte[] buffer = new byte[1024];
                int bytesRead = 0;
                while ((bytesRead = postStream.Read(buffer, 0, buffer.Length)) != 0)
                {
                    requestStream.Write(buffer, 0, bytesRead);
                }
                postStream.Close();//关闭文件访问
            }
            #endregion
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            using (Stream responseStream = response.GetResponseStream())
            {
                using (StreamReader myStreamReader = new StreamReader(responseStream, Encoding.GetEncoding(encoding)))
                {
                    string retString = myStreamReader.ReadToEnd();
                    return retString;
                }
            }
        }
        //public static string PostDataV2(string data, string url)
        //{
        //    WebClient wc = new WebClient();
        //    wc.Headers.Add("Content-Type", "application/json");
        //    byte[] postData = Encoding.ASCII.GetBytes(data);
        //    byte[] responseData = wc.UploadData(url, "POST", postData);
        //    return Encoding.UTF8.GetString(responseData);
        //}
    }
}
WebAPI/WebAPI.csproj
@@ -46,9 +46,9 @@
    <Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
      <HintPath>..\packages\Portable.BouncyCastle.1.8.9\lib\net40\BouncyCastle.Crypto.dll</HintPath>
    </Reference>
    <Reference Include="DAL, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
    <Reference Include="DAL, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\SRM-MES\SRM-MES\DAL\bin\Debug\DAL.dll</HintPath>
      <HintPath>..\..\..\SRM-MES\SRM-MES\DAL\bin\Debug\DAL.dll</HintPath>
    </Reference>
    <Reference Include="DBUtility, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
      <SpecificVersion>False</SpecificVersion>
@@ -240,6 +240,7 @@
    <Compile Include="MyHub.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Startup.cs" />
    <Compile Include="Utility\HttpHelper.cs" />
    <Compile Include="Utility\Util.cs" />
  </ItemGroup>
  <ItemGroup>
WebAPI/bin.7z
Binary files differ
È«²¿¿Í»§ÔÚÔËÓÃ.txt