예제 #1
0
        /// <summary>
        /// 规定装车顺序
        /// </summary>
        private void btnCreateTask_Click(object sender, EventArgs e)
        {
            try
            {
                if (listPersonnel.CheckedItems.Count < 1)
                {
                    MsgBox.Warn("请选择装车人员!");
                    return;
                }
                if (listTransPersonal.CheckedItems.Count < 1)
                {
                    MsgBox.Warn("请选称重人员!");
                    return;
                }
                if (this.SelectedBills.Count == 0)
                {
                    MsgBox.Warn("请选择订单!");
                    return;
                }
                VehicleEntity vehicle = this.searchLookUpEdit1.EditValue as VehicleEntity;
                if (vehicle == null)
                {
                    MsgBox.Warn("请选择车辆!");
                    return;
                }
                // 如果选择的是第三方车辆,验证散货信息
                if (vehicle.VhType == "191")
                {
                    string errorMsg = string.Empty;
                    this.ValidateContainerState(out errorMsg);
                    if (!string.IsNullOrEmpty(errorMsg))
                    {
                        MsgBox.Warn(errorMsg);
                        return;
                    }
                }
                List <UserEntity> userLoadingList = new List <UserEntity>();
                foreach (var obj in this.listPersonnel.CheckedItems)
                {
                    if (obj is UserEntity)
                    {
                        UserEntity user = obj as UserEntity;
                        userLoadingList.Add(user);
                    }
                }

                List <UserEntity> userTransList = new List <UserEntity>();
                foreach (var obj in this.listTransPersonal.CheckedItems)
                {
                    if (obj is UserEntity)
                    {
                        UserEntity user = obj as UserEntity;
                        userTransList.Add(user);
                    }
                }

                using (FrmLoadingSortMap frmSOSortMap = new FrmLoadingSortMap(this.SelectedBills, vehicle, userLoadingList, userTransList))
                {
                    if (frmSOSortMap.ShowDialog() == DialogResult.OK)
                    {
                        //生成叫号信息
                        foreach (UserEntity user in userLoadingList)
                        {
                            CreateCalling(BaseCodeConstant.TASK_LOADING, vehicle.VehicleNO, user.UserName, user.UserCode, -1);
                        }
                        this.LoadData();
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.Err("错误:" + ex.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// 装车
        /// </summary>
        private void btnCreateTask_Click(object sender, EventArgs e)
        {
            try
            {
                TMSDataHeader header = this.cboGroup.EditValue as TMSDataHeader;
                if (header == null)
                {
                    MsgBox.Warn("请选择组别!");
                    return;
                }

                if (listPersonnel.CheckedItems.Count < 1)
                {
                    MsgBox.Warn("请选择装车人员!");
                    return;
                }

                if (listTransPersonal.CheckedItems.Count < 1)
                {
                    MsgBox.Warn("请选称重人员!");
                    return;
                }

                VehicleEntity vehicle = this.searchLookUpEdit1.EditValue as VehicleEntity;
                if (vehicle == null)
                {
                    MsgBox.Warn("请选择车辆!");
                    return;
                }
                List <SOHeaderEntity> soHeaderList = this.gridHeader.DataSource as List <SOHeaderEntity>;
                if (soHeaderList == null || soHeaderList.Count == 0)
                {
                    MsgBox.Warn("当前组别未找到任何订单!");
                    return;
                }

                //装车人员
                List <UserEntity> userLoadingList = new List <UserEntity>();
                foreach (var obj in this.listPersonnel.CheckedItems)
                {
                    if (obj is UserEntity)
                    {
                        UserEntity user = obj as UserEntity;
                        userLoadingList.Add(user);
                    }
                }

                //称重人员
                List <UserEntity> userTransList = new List <UserEntity>();
                foreach (var obj in this.listTransPersonal.CheckedItems)
                {
                    if (obj is UserEntity)
                    {
                        UserEntity user = obj as UserEntity;
                        userTransList.Add(user);
                    }
                }

                LoadingHeaderEntity loadingHeader = new LoadingHeaderEntity()
                {
                    WarehouseCode = GlobeSettings.LoginedUser.WarehouseCode,
                    LoadingNO     = DateTime.Now.ToString("yyyyMMddHHmmssms"),
                    VehicleID     = vehicle.ID,
                    UserName      = GlobeSettings.LoginedUser.UserName,
                    UpdateDate    = DateTime.Now
                };

                List <LoadingDetailEntity> details = new List <LoadingDetailEntity>();
                foreach (SOHeaderEntity data in soHeaderList)
                {
                    details.Add(new LoadingDetailEntity()
                    {
                        LoadingNO     = loadingHeader.LoadingNO,
                        BillNO        = data.BillNO,
                        InVehicleSort = ConvertUtil.ToInt(data.OrderSort),
                        UpdateDate    = DateTime.Now,
                        BillID        = data.BillID
                    });
                }

                List <LoadingUserEntity> users = new List <LoadingUserEntity>();
                foreach (UserEntity item in userLoadingList)
                {
                    users.Add(new LoadingUserEntity()
                    {
                        LoadingNO  = loadingHeader.LoadingNO,
                        UserName   = item.UserName,
                        UserCode   = item.UserCode,
                        UpdateDate = DateTime.Now
                    });
                }

                //规定排序
                TMSDataHeader tmsDataHeader = this.cboGroup.EditValue as TMSDataHeader;
                if (tmsDataHeader == null)
                {
                    return;
                }
                using (FrmLoadingSortMap frmSOSortMap = new FrmLoadingSortMap(this.SelectedBills, vehicle, userLoadingList, userTransList, tmsDataHeader.id))
                {
                    if (frmSOSortMap.ShowDialog() == DialogResult.OK)
                    {
                        //生成叫号信息
                        foreach (UserEntity user in userLoadingList)
                        {
                            CreateCalling(BaseCodeConstant.TASK_LOADING, vehicle.VehicleNO, user.UserName, user.UserCode, -1);
                        }

                        // 修改TMS表头的本地状态
                        UpdateLocState(header.HeaderID, 1);
                    }
                }

                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MsgBox.Err("错误:" + ex.Message);
            }
        }