智云SRM-WEBAPI(目前客户通用API)
1
yangle
2023-10-18 ef1d4ad8269df16585d7b7b252d21cb3e29a5f11
WebAPI/Controllers/BarCodeController.cs
@@ -1547,6 +1547,7 @@
                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>();//外箱model
                List<Model.ClsGy_BarCodeBill_WMS_Model> ls3 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();//内箱model
                ls = oListModels.getObjectByJson_MaterialList(msg3);//列表数据model
                long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -1567,6 +1568,7 @@
                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)
@@ -1577,7 +1579,8 @@
                    //检验打印数量(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)
                    if (ds.Tables[0].Rows.Count > 0 && Convert.ToDouble(ds.Tables[0].Rows[0][0]) < oItemSub.HQty)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
@@ -1641,6 +1644,32 @@
                            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}'";
                            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;
@@ -1667,6 +1696,7 @@
                        }
                    }
                }
                oCn.Commit();
                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub2 in ls2)
                {
                    if (ClsPub.isLong(oItemSub2.HMaterID) != 0)
@@ -2008,12 +2038,19 @@
        }
        [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);