Ejemplo n.º 1
0
 public void SetOrderStatus(Scancode scancode, RequestOrder order)
 {
     //记录已经完成扫码的出库单
     WtdlSqlService.AddOrder(new W_OrderTable()
     {
         Accounts   = scancode.Adminaccount.Trim(),
         FinishTime = DateTime.Now,
         OrderId    = order.DDNO
     });
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 扫码发货
        /// </summary>
        /// <param name="sancode"></param>
        public void SanCodeAddcommand(Scancode scancode)
        {
            if (scancode.QrCode == "" || scancode.QrCode == null)
            {
                return;
            }
            if (scancode.QrCode.Length != 12)
            {
                butContentStatus = new ButContentStatus()
                {
                    packIconMaterialLight = ButContentStatus.AlertCircle, ErrorInfo = "请扫描正确的防伪码", ScanCount = tLabelsxModels.Count.ToString()
                };
                // ErrorInfo = "请扫描正确的标签二维码";
                return;
            }
            if (this.requestOrder == null)
            {
                butContentStatus = new ButContentStatus()
                {
                    packIconMaterialLight = ButContentStatus.AlertCircle, ErrorInfo = "请选择出库单", ScanCount = tLabelsxModels.Count.ToString()
                };
                // ErrorInfo = "请选择出库单";
                return;
            }
            int count = Convert.ToInt32(this.requestOrder.OrderCount) + Convert.ToInt32(butContentStatus.ScanCount);

            if (count == Convert.ToInt32(requestOrder.SL))
            {
                butContentStatus = new ButContentStatus()
                {
                    packIconMaterialLight = ButContentStatus.Check, ErrorInfo = "当前放行单已经完成出库", ScanCount = tLabelsxModels.Count.ToString()
                };
                Task task = Task.Run(() => {
                    SetOrderStatus(scancode, this.requestOrder);
                });
                return;
            }
            if (tLabelsxModels != null && (tLabelsxModels.FirstOrDefault(t => t.QRCode.Contains(scancode.QrCode)) == null))
            {
                var AddtLabelx = new AddtLabelx
                {
                    QRCode        = scancode.QrCode,
                    OrderTime     = DateTime.Parse(this.requestOrder.DDRQ),
                    Dealers       = this.requestOrder.DDNO,//WtdlSqlService.GetAgentId(this.requestOrder.KH),
                    DealersName   = this.requestOrder.KH,
                    Adminaccount  = scancode.Adminaccount,
                    ExtensionName = "",
                    OrderNumbels  = this.requestOrder.DDNO,
                    OutType       = "THFX",
                };
                tLabelsxModel remodel = WtdlSqlService.AddtLabelX(AddtLabelx);


                if (remodel.ResulCode == 404)
                {
                    butContentStatus = new ButContentStatus()
                    {
                        packIconMaterialLight = ButContentStatus.Alert, ErrorInfo = remodel.Errorinfo, ScanCount = tLabelsxModels.Count.ToString()
                    };
                    tLabelsxModelsError.Insert(0, remodel);
                    WtdlSqlService.DeeletetLabelX(remodel);
                    return;
                }
                else
                {
                    tLabelsxModels.Insert(0, remodel);
                    butContentStatus = new ButContentStatus()
                    {
                        packIconMaterialLight = ButContentStatus.Check, ErrorInfo = "扫码出库成功", ScanCount = tLabelsxModels.Count.ToString()
                    };
                }

                //ScanCount = tLabelsxModels.Count.ToString();
                //ErrorInfo = remodel.ResultStatus;
            }
            else
            {
                butContentStatus = new ButContentStatus()
                {
                    packIconMaterialLight = ButContentStatus.Check, ErrorInfo = "请不要重复扫描", ScanCount = tLabelsxModels.Count.ToString()
                };
                //ScanCount = tLabelsxModels.Count.ToString();
                //ErrorInfo = "请不要重复扫描";
            }
        }