| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Identity; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Options; |
| | | using Model.InterFaceModel; |
| | | using Model.ModelDto.BllAsnDto; |
| | | using Model.ModelDto.DataDto; |
| | | using Model.ModelVm; |
| | | using Model.ModelVm.BllAsnVm; |
| | | using Model.ModelVm.PdaVm; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Security.Claims; |
| | | using Utility; |
| | | using Utility.Tools; |
| | | using Wms.Tools; |
| | | using WMS.BLL.LogServer; |
| | | using WMS.Entity.BllAsnEntity; |
| | | using WMS.Entity.DataEntity; |
| | | using WMS.IBLL.IPdaServer; |
| | | |
| | | namespace Wms.Controllers |
| | |
| | | [Authorize] |
| | | public class PdaAsnController : ControllerBase |
| | | { |
| | | #region 依赖注入 |
| | | private readonly ApiUrlConfig _config; //接口交互路径 |
| | | private readonly IPdaAsnServer _PdaAsnSvc; |
| | | private readonly UserManager _userManager; |
| | | |
| | | public PdaAsnController(IPdaAsnServer pdaAsnSvc) |
| | | public PdaAsnController(IOptions<ApiUrlConfig> setting, IPdaAsnServer pdaAsnSvc,UserManager userManager) |
| | | { |
| | | _PdaAsnSvc = pdaAsnSvc; |
| | | _config = setting.Value; |
| | | _PdaAsnSvc = pdaAsnSvc; |
| | | _userManager = userManager; |
| | | } |
| | | |
| | | |
| | | #region JC34 |
| | | |
| | | //---------------------------------------------组托收货页面---------------------------------------------------------------------- |
| | | |
| | | /// <summary> |
| | | /// 绑定托盘 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [UnitOfWork] |
| | | public IActionResult BindPallet(PdaPalletBindVm model) |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | if (model.TableType == 0) |
| | | { |
| | | _PdaAsnSvc.BindPalletPasteCode(model, int.Parse(UserId)); |
| | | } |
| | | else if (model.TableType == 1) |
| | | { |
| | | _PdaAsnSvc.BindPalletNoPasteCode(model, int.Parse(UserId)); |
| | | } |
| | | |
| | | return Ok(new { code = 0, msg = "绑定成功!" }); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取需要贴标签的入库单 单据号集合 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetPasteAsnNoStrList() |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetPasteAsnNoStrList(); |
| | | |
| | | return Ok(new { code = 0, msg = "入库单信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取不需要贴标签的入库单 单据号集合 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetNoPasteAsnNoStrList() |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetNoPasteAsnNoStrList(); |
| | | |
| | | return Ok(new { code = 0, msg = "入库单信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据单据号获取贴标的入库单据信息(ID-物料-批次) |
| | | /// </summary> |
| | | /// <param name="model">AsnNo:单据号</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetBindArrivalNoticeDetails(ArrivalNoticeVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetBindArrivalNoticeDetails(model); |
| | | |
| | | return Ok(new { code = 0, msg = "入库单明细信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据单据号获取不贴标的入库单据信息(ID-物料-批次) |
| | | /// </summary> |
| | | /// <param name="model">AsnNo:单据号</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetArrivalNoticeDetails(ArrivalNoticeVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetArrivalNoticeDetails(model); |
| | | |
| | | return Ok(new { code = 0, msg = "入库单明细信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据入库单明细ID获取物料详情 (PDA物料批次选项数据) |
| | | /// </summary> |
| | | /// <param name="model">Id:入库单明细ID</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetArrivalNoticeDetail(ArrivalNoticeDetailVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetArrivalNoticeDetail(model); |
| | | |
| | | return Ok(new { code = 0, msg = "入库单明细详细信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据箱码获取标签箱码信息 |
| | | /// </summary> |
| | | /// <param name="model">BoxNo:箱号</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetBindBoxInfos(BoxInfoVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetBindBoxInfos(model, _config.BoxHost + _config.GetBoxUrl); |
| | | |
| | | return Ok(new { code = 0, msg = "标签箱码信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断托盘是否可用 公用方法 |
| | | /// </summary> |
| | | /// <param name="model">PalletNo:托盘条码</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult IsEnablePalletNo(PalletBindVm model) |
| | | { |
| | | try |
| | | { |
| | | var strMsg = _PdaAsnSvc.IsEnablePalletNo(model.PalletNo); |
| | | |
| | | if (strMsg == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "托盘可用!" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = strMsg }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据单据获取标签数量 |
| | | /// </summary> |
| | | /// <param name="model">ASNNo:入库单、ASNDetailNo:入库单明细号</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetBoxCountByAsn(PalletBindVm model) |
| | | { |
| | | try |
| | | { |
| | | var list = _PdaAsnSvc.GetBoxCountByAsn(model.ASNNo,model.ASNDetailNo); |
| | | |
| | | |
| | | return Ok(new { code = 0, msg = "根据单据获取标签数量", data= list}); |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | |
| | | //---------------------------------------------申请入库页面---------------------------------------------------------------------- |
| | | |
| | | |
| | | /// <summary> |
| | | /// 保存指定的储位 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult SaveAppointLocate(PalletBindVm model) |
| | | { |
| | | try |
| | | { |
| | | _PdaAsnSvc.SaveAppointLocate(model.PalletNo, model.LocatNo, _userManager.UserId); |
| | | |
| | | return Ok(new HttpReturnModel{ Success = "0", Message = "成功指定储位" }); |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new HttpReturnModel { Success = "1", Message = e.Message }); |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 公用方法 |
| | | /// <summary> |
| | |
| | | { |
| | | return Ok(new { code = 0, msg = "入库单信息", data = models }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断托盘是否可用 |
| | | /// </summary> |
| | | /// <param name="model">PalletNo:托盘条码</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult IsEnablePalletNo(PalletBindVm model) |
| | | { |
| | | try |
| | | { |
| | | var strMsg = _PdaAsnSvc.IsEnablePalletNo(model.PalletNo); |
| | | |
| | | if (strMsg == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "托盘可用!" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = strMsg }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取单据明细列表 |
| | | /// </summary> |
| | | /// <param name="model">AsnNo:单据号</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetArrivalNoticeDetails(ArrivalNoticeVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetArrivalNoticeDetails(model); |
| | | |
| | | return Ok(new { code = 0, msg = "入库单明细信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据明细ID获取物料详情 |
| | | /// </summary> |
| | | /// <param name="model">Id:入库单明细ID</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetArrivalNoticeDetail(ArrivalNoticeDetailVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetArrivalNoticeDetail(model); |
| | | |
| | | return Ok(new { code = 0, msg = "入库单明细详细信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 生产入库 |
| | | |
| | | #endregion |
| | | |
| | | #region 空托入库 |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 组托 |
| | | /// <summary> |
| | | /// 根据箱码获取标签箱码信息 |
| | | /// </summary> |
| | | /// <param name="model">BoxNo:箱号</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetBindBoxInfos(BoxInfoVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetBindBoxInfos(model); |
| | | |
| | | return Ok(new { code = 0, msg = "标签箱码信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | [HttpPost] |
| | | public IActionResult GetBindArrivalNoticeDetails(ArrivalNoticeVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _PdaAsnSvc.GetBindArrivalNoticeDetails(model); |
| | | |
| | | return Ok(new { code = 0, msg = "入库单明细信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定托盘 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [UnitOfWork] |
| | | public IActionResult BindPallet(PdaPalletBindVm model) |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | if (model.TableType == 0) |
| | | { |
| | | _PdaAsnSvc.BindPalletPasteCode(model, int.Parse(UserId)); |
| | | } |
| | | else if (model.TableType == 1) |
| | | { |
| | | _PdaAsnSvc.BindPalletNoPasteCode(model, int.Parse(UserId)); |
| | | } |
| | | |
| | | return Ok(new { code = 0, msg = "绑定成功!" }); |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 平库入库 |
| | | /// <summary> |