dengjunjie
2025-10-23 4cca607ddce9577864b8a5c9c8edf7c83915b787
修改物料信息删除方法
已修改3个文件
96 ■■■■ 文件已修改
新建文件夹/WIDESEA_WMSServer/ClassLibrary2/MaterielInfoService.cs 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_BasicService/MaterielInfoService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/MedicineGoodsServices.cs 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
н¨Îļþ¼Ð/WIDESEA_WMSServer/ClassLibrary2/MaterielInfoService.cs
@@ -1,12 +1,18 @@
using System;
using HslCommunication;
using Newtonsoft.Json;
using Quartz.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
using WIDESEA_IWMsInfoServices;
using WIDESEA_Model.Models;
using static WIDESEA_DTO.SquareCabin.TowcsDto;
namespace WIDESEA_WMsInfoServices
{
@@ -15,5 +21,58 @@
        public MaterielInfoService(IRepository<Dt_MaterielInfo> BaseDal) : base(BaseDal)
        {
        }
        public IRepository<Dt_MaterielInfo> Repository => BaseDal;
        public override WebResponseContent DeleteData(object[] keys)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                if (keys.ToList().Count > 1) throw new Exception("一次只能选择一条数据");
                Dt_MaterielInfo goods = BaseDal.QueryFirst(x => keys.Contains(x.Id));
                var medicineDTO = new ProductInfo
                {
                    //用户code
                    customerCode = "905",
                    //物料类型
                    materialCode = "YY",
                    //产品编码
                    productCode = goods.MaterielCode,
                    //产品名
                    productName = goods.MaterielName,
                    //产品条码
                    productBarCode = goods.MaterielCode,
                    //规格
                    productSpecifications = goods.MaterielSpec,
                    //单位
                    unit = goods.MaterielUnit,
                    //长
                    singleProductLongNum = goods.MaterielLength.ToString(),
                    //宽
                    singleProductWideNum = goods.MaterielWide.ToString(),
                    //高
                    singleProductHighNum = goods.MaterielHeight.ToString(),
                    //重量
                    singleProductWeight = goods.MaterielWeight.ToString(),
                    //体积
                    singleProductVolume = goods.MaterielVolume.ToString(),
                    //是否取消 0是不删除,1删除
                    isDelete = "1"
                };
                var url = "http://172.16.1.2:9357/file-admin/api/product/productSynchronous";
                //var url = "http://172.16.1.245:9357/file-admin/api/product/productSynchronous";
                var result = HttpHelper.Post(url, medicineDTO.ToJsonString());
                var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
                if (resp != null && resp.code == "0") return base.DeleteData(keys);
                return WebResponseContent.Instance.Error("删除失败请重试");
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
    }
}
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_BasicService/MaterielInfoService.cs
@@ -24,7 +24,5 @@
        }
        public IRepository<Dt_MaterielInfo> Repository => BaseDal;
    }
}
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/MedicineGoodsServices.cs
@@ -38,8 +38,8 @@
            var responseContent = new WebResponseContent();
            try
            {
              var url = "http://121.37.118.63:80/GYZ2/95fck/goodsInfo";
                var url = "http://121.37.118.63:80/GYZ2/95fck/goodsInfo";
                //if (string.IsNullOrEmpty(SearchDate)) SearchDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@@ -92,7 +92,7 @@
                    Factory = Medicat.factory,
                    MaterielUnit = Medicat.unit,//单位
                    // ä½¿ç”¨ ?? è¿ç®—符提供默认值
                    MaterielLength = (float?)Medicat.item_length ,
                    MaterielLength = (float?)Medicat.item_length,
                    MaterielWide = (float?)Medicat.item_width,
                    MaterielHeight = (float?)Medicat.item_hight,
                    MaterielVolume = (float?)Medicat.item_volumn,
@@ -108,7 +108,7 @@
                ProductSynchronous();
                return responseContent.OK("同步成功");
            }
            catch (Exception ex)
            {
                SendErrorToUpstream(5, "", ex.Message, "");
@@ -128,7 +128,7 @@
                //先找到所有未下发的药品
                //var list = BaseDal.QueryData(x => x.GoodStatus == "未下发").ToList();
                //把小件未下发的的信息
                var list =BaseDal.Db.Queryable<Dt_MaterielInfo>().Where(x => x.GoodStatusState == "未下发"&& x.MaterielSourceType== MaterielSourceTypeEnum.SelfMadePart).ToList();
                var list = BaseDal.Db.Queryable<Dt_MaterielInfo>().Where(x => x.GoodStatusState == "未下发" && x.MaterielSourceType == MaterielSourceTypeEnum.SelfMadePart).ToList();
                if (list == null || !list.Any())
                {
                    return new WebResponseContent().OK("无未下发药品");
@@ -141,16 +141,16 @@
                        //用户code
                        customerCode = "905",
                        //物料类型
                        materialCode =item.MaterielErpType,
                        materialCode = item.MaterielErpType,
                        //产品编码
                        productCode= item.MaterielCode,
                        productCode = item.MaterielCode,
                        //产品名
                        productName =item.MaterielName,
                        productName = item.MaterielName,
                        //产品条码
                        productBarCode= item.MaterielCode,
                        productBarCode = item.MaterielCode,
                        //规格
                        productSpecifications=item.MaterielSpec,
                        productSpecifications = item.MaterielSpec,
                        //单位
                        unit = item.MaterielUnit,
                        //长
@@ -170,18 +170,18 @@
                    var result = HttpHelper.Post(url, medicineDTO.ToJsonString());
                    var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
                    if (resp!=null&&resp.code=="0")
                    if (resp != null && resp.code == "0")
                    {
                        //更新药品状态-已完成
                        BaseDal.Db.Updateable<Dt_MaterielInfo>()
                            .SetColumns(x => x.GoodStatusState == "下发完成")
                            .Where(x => x.MaterielCode == item.MaterielCode)
                            .ExecuteCommand();
                            .ExecuteCommand();
                    }
                    else
                    {
                        SendErrorToUpstream(5, medicineDTO.materialCode, resp?.msg ?? "WCS药品信息同步失败", "");
                        return new WebResponseContent { Status = false, Message = "订单推送失败" };
                    }
@@ -205,7 +205,7 @@
        {
            try
            {
                var goods = BaseDal.Db.Queryable< Dt_MaterielInfo >().Where(x => x.MaterielCode == goodsno).First();
                var goods = BaseDal.Db.Queryable<Dt_MaterielInfo>().Where(x => x.MaterielCode == goodsno).First();
                if (goods == null)
                {
                    return new WebResponseContent
@@ -259,8 +259,7 @@
            }
            catch (Exception ex)
            {
              return new WebResponseContent { Status=false,Message = ex.Message };
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
@@ -292,6 +291,6 @@
            }
        }
    }
}