public MesStockinTaskItemViewModel(OutsideStockInDto data)
        {
            _data      = data;
            this.Title = "入库任务:" + data.WarehousingId;
            this.Datas.Add(new TaskItemData("发送", JsonConvert.SerializeObject(data)));
            var binding = new BasicHttpBinding();

            binding.SendTimeout    = new TimeSpan(1, 0, 0);
            binding.ReceiveTimeout = new TimeSpan(1, 0, 0);
            //var factory = new ChannelFactory<WMSSoap>(binding, "http://localhost:5713/WMS.asmx");
            var factory = new ChannelFactory <WMSService.IMESHookController>(binding, "http://localhost:23456/Outside/MesHook.asmx");

            _mesHook = factory.CreateChannel();
            ReSend(null);
        }
Exemplo n.º 2
0
 public MesStockinCreateWindow()
 {
     InitializeComponent();
     colSupplies.ItemsSource = SuppliesItems;
     _data = new OutsideStockInDto();
     _data.WarehousingId    = "RK-" + DateTime.Now.ToString("yyyyMMddHHmmss");
     _data.WarehousingTime  = DateTime.Now.ToString("yyyy-MM-dd");
     _data.WarehousingType  = "采购入库单";
     _data.ProductionPlanId = DateTime.Now.Ticks.ToString();
     _data.BatchPlanId      = DateTime.Now.TimeOfDay.Ticks.ToString();
     _data.WorkAreaName     = "工作区1";
     _data.SuppliesKinds    = 1;
     this.SuppliesInfoList  = new List <YL.Core.Dto.OutsideWarehousingMaterialDto>();
     _data.SuppliesInfoList = JsonConvert.SerializeObject(SuppliesInfoList);
     AddMaterial_Click(null, null);
     this.DataContext = _data;
 }
Exemplo n.º 3
0
 public MesStockinCreateWindow(OutsideStockInDto data)
 {
     InitializeComponent();
     _data            = data;
     this.DataContext = _data;
 }
Exemplo n.º 4
0
        //public OutsideStockInResult Warehousing([FromBody]OutsideStockInDto data)
        public string Warehousing(string WarehousingId, string WarehousingType, string WarehousingTime, string ProductionPlanId, string BatchPlanId, string WorkAreaName, string SuppliesKinds, string SuppliesInfoList)
        {
            OutsideStockInDto data      = null;
            string            resultStr = null;

            try
            {
                data = OutsideStockInDto.Create(
                    Guard.GuardEmpty(() => WarehousingId),
                    Guard.GuardEmpty(() => WarehousingType),
                    Guard.GuardEmpty(() => WarehousingTime),
                    Guard.GuardEmpty(() => ProductionPlanId),
                    Guard.GuardEmpty(() => BatchPlanId),
                    Guard.GuardEmpty(() => WorkAreaName),
                    Guard.GuardInteger(() => SuppliesKinds),
                    Guard.GuardEmpty(() => SuppliesInfoList)
                    );

                _sqlClient.BeginTran();
                string jsonSuppliesInfoStr = data.SuppliesInfoList;
                OutsideWarehousingMaterialDto[] suppliesInfos = JsonConvert.DeserializeObject <OutsideWarehousingMaterialDto[]>(jsonSuppliesInfoStr);
                Wms_mestask mesTask = new Wms_mestask()
                {
                    MesTaskId        = PubId.SnowflakeId,
                    MesTaskType      = MESTaskTypes.StockIn,
                    WarehousingId    = data.WarehousingId,                       //入库单编号
                    WarehousingType  = data.WarehousingType,                     //入库类型
                    WarehousingTime  = Convert.ToDateTime(data.WarehousingTime), //入库时间
                    ProductionPlanId = data.ProductionPlanId,                    //生产令号
                    BatchPlanId      = data.BatchPlanId,                         //批次号
                    WorkAreaName     = data.WorkAreaName,                        //作业区
                    SuppliesKinds    = data.SuppliesKinds,                       //物料种类
                    SuppliesInfoJson = "",                                       // jsonSuppliesInfoStr, //物料信息
                    WorkStatus       = MESTaskWorkStatus.WaitPlan,               //等待计划
                    NotifyStatus     = MESTaskNotifyStatus.Requested,            //已接收
                    CreateDate       = DateTime.Now
                };
                _mastaskServices.Insert(mesTask);

                RouteData routeData = CreateWMSStockin(mesTask, suppliesInfos);
                if (!routeData.IsSccuess)
                {
                    _sqlClient.RollbackTran();
                    OutsideStockInResult result = new OutsideStockInResult()
                    {
                        ErrorId         = routeData.CodeString,
                        ErrorInfo       = routeData.Message,
                        Success         = false,
                        WarehousingId   = data.WarehousingId,
                        WarehousingTime = data.WarehousingTime
                    };
                    resultStr = JsonConvert.SerializeObject(result);
                    return(resultStr);
                }
                else
                {
                    _sqlClient.CommitTran();
                    OutsideStockInResult result = new OutsideStockInResult()
                    {
                        Success         = true,
                        ErrorId         = string.Empty,
                        ErrorInfo       = string.Empty,
                        WarehousingId   = data.WarehousingId,
                        WarehousingTime = data.WarehousingTime
                    };
                    resultStr = JsonConvert.SerializeObject(result);
                    return(resultStr);
                }
            }
            catch (Exception ex)
            {
                _sqlClient.RollbackTran();
                OutsideStockInResult result = new OutsideStockInResult()
                {
                    Success   = false,
                    ErrorId   = "-1",
                    ErrorInfo = ex.ToString()
                                //  WarehousingId = Warehousingid,
                                //  WarehousingTime = Warehousingtime
                };
                resultStr = JsonConvert.SerializeObject(result);
                return(resultStr);
            }
            finally {
                LogRequest("Warehousing", data, resultStr);
            }
        }