
24 changed files with 936 additions and 54 deletions
@ -0,0 +1,34 @@ |
|||
package com.yxt.anrui.terminal.api.as.storechange; |
|||
|
|||
import com.yxt.anrui.terminal.api.as.firstshelves.AppFirstShelvesDto; |
|||
import com.yxt.anrui.terminal.api.as.firstshelves.AppFirstShelvesQuery; |
|||
import com.yxt.anrui.terminal.api.as.firstshelves.AppFirstShelvesScanVo; |
|||
import com.yxt.anrui.terminal.api.as.firstshelves.AppFirstShelvesVo; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* @Author |
|||
* @Date |
|||
* @Description |
|||
*/ |
|||
@FeignClient( |
|||
contextId = "terminal-AppStoreChange", |
|||
name = "anrui-terminal", |
|||
path = "v1/storeChange") |
|||
public interface AppStoreChangeFeign { |
|||
|
|||
@ApiOperation("标签扫描") |
|||
@GetMapping("/scan") |
|||
@ResponseBody |
|||
public ResultBean<AppStoreChangeScanVo> scan(@RequestParam("content") String content, @RequestParam("type") String type, @RequestParam("orgPath") String orgPath, @RequestParam(value = "storeSid", required = false) String storeSid); |
|||
|
|||
@ApiOperation("上架保存") |
|||
@PostMapping("/save") |
|||
@ResponseBody |
|||
public ResultBean save(@RequestBody AppFirstShelvesDto dto); |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.yxt.anrui.terminal.api.as.storechange; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class AppStoreChangeScanVo implements Vo { |
|||
|
|||
@ApiModelProperty("0商品码,1库位码") |
|||
private String type; |
|||
@ApiModelProperty("商品sid") |
|||
private String sid; |
|||
@ApiModelProperty("商品下的库存表里的sid集合") |
|||
private List<String> storeSids; |
|||
@ApiModelProperty("库位码") |
|||
private String houseCode; |
|||
@ApiModelProperty("库区名+库位名") |
|||
private String houseName; |
|||
@ApiModelProperty("仓库地址") |
|||
private String houseAddress; |
|||
} |
@ -0,0 +1,53 @@ |
|||
/********************************************************* |
|||
********************************************************* |
|||
******************** ******************* |
|||
************* ************ |
|||
******* _oo0oo_ ******* |
|||
*** o8888888o *** |
|||
* 88" . "88 * |
|||
* (| -_- |) * |
|||
* 0\ = /0 * |
|||
* ___/`---'\___ * |
|||
* .' \\| |// '. *
|
|||
* / \\||| : |||// \ *
|
|||
* / _||||| -:- |||||- \ * |
|||
* | | \\\ - /// | | *
|
|||
* | \_| ''\---/'' |_/ | * |
|||
* \ .-\__ '-' ___/-. / * |
|||
* ___'. .' /--.--\ `. .'___ * |
|||
* ."" '< `.___\_<|>_/___.' >' "". * |
|||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * |
|||
* \ \ `_. \_ __\ /__ _/ .-` / / * |
|||
* =====`-.____`.___ \_____/___.-`___.-'===== * |
|||
* `=---=' * |
|||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * |
|||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__********* |
|||
*********************************************************/ |
|||
package com.yxt.anrui.terminal.biz.as.storechange; |
|||
|
|||
import com.yxt.anrui.terminal.api.as.firstshelves.*; |
|||
import com.yxt.anrui.terminal.api.as.storechange.AppStoreChangeFeign; |
|||
import com.yxt.anrui.terminal.api.as.storechange.AppStoreChangeScanVo; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequestMapping("v1/storeChange") |
|||
public class AppStoreChangeRest implements AppStoreChangeFeign { |
|||
|
|||
@Autowired |
|||
private AppStoreChangeService appStoreChangeService; |
|||
|
|||
@Override |
|||
public ResultBean<AppStoreChangeScanVo> scan(String content, String type, String orgPath, String storeSid) { |
|||
return appStoreChangeService.scan(content, type, orgPath, storeSid); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean save(AppFirstShelvesDto dto) { |
|||
return appStoreChangeService.save(dto); |
|||
} |
|||
} |
@ -0,0 +1,207 @@ |
|||
/********************************************************* |
|||
********************************************************* |
|||
******************** ******************* |
|||
************* ************ |
|||
******* _oo0oo_ ******* |
|||
*** o8888888o *** |
|||
* 88" . "88 * |
|||
* (| -_- |) * |
|||
* 0\ = /0 * |
|||
* ___/`---'\___ * |
|||
* .' \\| |// '. *
|
|||
* / \\||| : |||// \ *
|
|||
* / _||||| -:- |||||- \ * |
|||
* | | \\\ - /// | | *
|
|||
* | \_| ''\---/'' |_/ | * |
|||
* \ .-\__ '-' ___/-. / * |
|||
* ___'. .' /--.--\ `. .'___ * |
|||
* ."" '< `.___\_<|>_/___.' >' "". * |
|||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * |
|||
* \ \ `_. \_ __\ /__ _/ .-` / / * |
|||
* =====`-.____`.___ \_____/___.-`___.-'===== * |
|||
* `=---=' * |
|||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * |
|||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__********* |
|||
*********************************************************/ |
|||
package com.yxt.anrui.terminal.biz.as.storechange; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|||
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|||
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|||
import com.yxt.anrui.terminal.api.as.firstshelves.*; |
|||
import com.yxt.anrui.terminal.api.as.storechange.AppStoreChangeScanVo; |
|||
import com.yxt.anrui.terminal.fegin.wmsInventory.WmsInventory; |
|||
import com.yxt.anrui.terminal.fegin.wmsInventory.WmsInventoryFeign; |
|||
import com.yxt.anrui.terminal.fegin.wmsInventory.WmsInventorySaveDto; |
|||
import com.yxt.anrui.terminal.fegin.wmsgoodstag.GoodsTagListQuery; |
|||
import com.yxt.anrui.terminal.fegin.wmsgoodstag.WmsGoodsTag; |
|||
import com.yxt.anrui.terminal.fegin.wmsgoodstag.WmsGoodsTagFeign; |
|||
import com.yxt.anrui.terminal.fegin.wmsinitialdetail.WmsInitialDetail; |
|||
import com.yxt.anrui.terminal.fegin.wmsinitialdetail.WmsInitialDetailFeign; |
|||
import com.yxt.anrui.terminal.fegin.wmswarehouserack.WmsHouseInfoVo; |
|||
import com.yxt.anrui.terminal.fegin.wmswarehouserack.WmsWarehouseRackFeign; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.math.BigDecimal; |
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
public class AppStoreChangeService { |
|||
|
|||
@Resource |
|||
private WmsGoodsTagFeign wmsGoodsTagFeign; |
|||
@Resource |
|||
private WmsWarehouseRackFeign wmsWarehouseRackFeign; |
|||
@Resource |
|||
private WmsInventoryFeign wmsInventoryFeign; |
|||
@Resource |
|||
private WmsInitialDetailFeign wmsInitialDetailFeign; |
|||
@Autowired |
|||
private SysStaffOrgFeign sysStaffOrgFeign; |
|||
@Autowired |
|||
private SysOrganizationFeign sysOrganizationFeign; |
|||
|
|||
public ResultBean<AppFirstShelvesVo> list(PagerQuery<AppFirstShelvesQuery> pagerQuery) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
PagerQuery<GoodsTagListQuery> pagerQuery1 = new PagerQuery<>(); |
|||
GoodsTagListQuery params = new GoodsTagListQuery(); |
|||
AppFirstShelvesQuery params1 = pagerQuery.getParams(); |
|||
params.setUserSid(params1.getUserSid()); |
|||
params.setOrgPath(params1.getOrgPath()); |
|||
params.setMenuSid(params1.getMenuSid()); |
|||
params.setName(params1.getName()); |
|||
pagerQuery1.setParams(params); |
|||
pagerQuery1.setSize(1000); |
|||
PagerVo<WmsGoodsTag> data = wmsGoodsTagFeign.goodsTagList(pagerQuery1).getData(); |
|||
AppFirstShelvesVo appFirstShelvesVo = new AppFirstShelvesVo(); |
|||
List<AppFirstShelvesGoodsVo> goods = new ArrayList<>(); |
|||
List<WmsGoodsTag> list = data.getRecords(); |
|||
for (WmsGoodsTag wmsGoodsTag : list) { |
|||
AppFirstShelvesGoodsVo appFirstShelvesGoodsVo = new AppFirstShelvesGoodsVo(); |
|||
appFirstShelvesGoodsVo.setSid(wmsGoodsTag.getSid()); |
|||
appFirstShelvesGoodsVo.setName(wmsGoodsTag.getGoodsSkuTitle()); |
|||
appFirstShelvesGoodsVo.set_id(wmsGoodsTag.getGoodsID()); |
|||
appFirstShelvesGoodsVo.setNum(wmsGoodsTag.getGoodsCount()); |
|||
appFirstShelvesGoodsVo.setUnit(wmsGoodsTag.getUnit()); |
|||
appFirstShelvesGoodsVo.setSpecs(wmsGoodsTag.getGoodsSkuOwnSpec()); |
|||
goods.add(appFirstShelvesGoodsVo); |
|||
} |
|||
appFirstShelvesVo.setGoods(goods); |
|||
return rb.success().setData(appFirstShelvesVo); |
|||
} |
|||
|
|||
public ResultBean<AppStoreChangeScanVo> scan(String content, String type, String orgPath, String storeSid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
String deptSid = ""; |
|||
if (StringUtils.isNotBlank(orgPath)) { |
|||
List<String> split = Arrays.asList(orgPath.split("/")); |
|||
if (split.size() > 1) { |
|||
//获取本级sid获取本级部门信息
|
|||
SysOrganizationVo sysOrganization1 = sysOrganizationFeign.fetchBySid(split.get(split.size() - 1)).getData(); |
|||
deptSid = sysOrganization1.getSid(); |
|||
} else { |
|||
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(split.get(0)).getData(); |
|||
deptSid = sysOrganization.getSid(); |
|||
} |
|||
} |
|||
AppStoreChangeScanVo appStoreChangeScanVo = new AppStoreChangeScanVo(); |
|||
if ("0".equals(type)) {//商品码
|
|||
if (content.contains("#")) { |
|||
return rb.setMsg("请扫描商品码"); |
|||
} |
|||
if (StringUtils.isBlank(storeSid)) { |
|||
List<WmsInventory> wmsInventoryList = wmsInventoryFeign.selByGoodsIDAndUseOrgSid(content, deptSid).getData(); |
|||
if (wmsInventoryList.size() == 0) { |
|||
return rb.setMsg("当前商品不可移位"); |
|||
} |
|||
appStoreChangeScanVo.setType(type); |
|||
appStoreChangeScanVo.setSid(wmsInventoryList.get(0).getGoodsSpuSid()); |
|||
appStoreChangeScanVo.setStoreSids(wmsInventoryList.stream().map(WmsInventory::getWarehouseSid).collect(Collectors.toList())); |
|||
} else { |
|||
List<WmsInventory> wmsInventoryList = wmsInventoryFeign.selByGoodsIDAndUseOrgSidAndWarehouseSid(content, deptSid, storeSid).getData(); |
|||
appStoreChangeScanVo.setType(type); |
|||
appStoreChangeScanVo.setSid(wmsInventoryList.get(0).getGoodsSpuSid()); |
|||
appStoreChangeScanVo.setStoreSids(wmsInventoryList.stream().map(WmsInventory::getWarehouseSid).collect(Collectors.toList())); |
|||
} |
|||
} else if ("1".equals(type)) {//库位码
|
|||
if (!content.contains("#")) { |
|||
return rb.setMsg("请扫描库位码"); |
|||
} |
|||
String[] split = content.split("#"); |
|||
String houseCode = split[0]; |
|||
ResultBean<WmsHouseInfoVo> wmsHouseInfoVoResultBean = wmsWarehouseRackFeign.selHouseInfoByFullCode(houseCode); |
|||
if (wmsHouseInfoVoResultBean.getSuccess()) { |
|||
WmsHouseInfoVo houseInfoVo = wmsHouseInfoVoResultBean.getData(); |
|||
if (null != houseInfoVo) { |
|||
String houseName = ""; |
|||
String areaName = ""; |
|||
String rackName = ""; |
|||
String zoneName = ""; |
|||
if (StringUtils.isNotBlank(houseInfoVo.getWarehouseName())) { |
|||
houseName = houseInfoVo.getWarehouseName(); |
|||
} |
|||
if (StringUtils.isNotBlank(houseInfoVo.getWareAreaName())) { |
|||
areaName = houseInfoVo.getWareAreaName(); |
|||
} |
|||
if (StringUtils.isNotBlank(houseInfoVo.getWarehouseRackName())) { |
|||
rackName = houseInfoVo.getWarehouseRackName(); |
|||
} |
|||
if (StringUtils.isNotBlank(houseInfoVo.getWarehouseZoneName())) { |
|||
zoneName = houseInfoVo.getWarehouseZoneName(); |
|||
} |
|||
appStoreChangeScanVo.setHouseName(houseName + "-" + zoneName + "-" + areaName); |
|||
appStoreChangeScanVo.setHouseAddress(houseInfoVo.getWarehouseRackCode()); |
|||
appStoreChangeScanVo.setHouseCode(houseCode); |
|||
appStoreChangeScanVo.setType(type); |
|||
} else { |
|||
return rb.setMsg("扫描库位码为空"); |
|||
} |
|||
} |
|||
} |
|||
return rb.success().setData(appStoreChangeScanVo); |
|||
} |
|||
|
|||
public ResultBean save(AppFirstShelvesDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<AppFirstShelvesGoodsDto> goodsList = dto.getGoodsList(); |
|||
WmsInventorySaveDto wmsInventorySaveDto = new WmsInventorySaveDto(); |
|||
wmsInventorySaveDto.setCreateBySid(dto.getUserSid()); |
|||
String useOrgSid = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgPath()).getData(); |
|||
wmsInventorySaveDto.setCreateOrgSid(useOrgSid); |
|||
wmsInventorySaveDto.setUseOrgSid(useOrgSid); |
|||
wmsInventorySaveDto.setFirstInDate(DateUtil.today()); |
|||
for (AppFirstShelvesGoodsDto appFirstShelvesGoodsDto : goodsList) { |
|||
WmsGoodsTag wmsGoodsTag = wmsGoodsTagFeign.selectByGoodsId(appFirstShelvesGoodsDto.getGoodsID()).getData(); |
|||
WmsInitialDetail wmsInitialDetail = wmsInitialDetailFeign.selBySid(wmsGoodsTag.getBillDetailSid()).getData(); |
|||
WmsHouseInfoVo wmsHouseInfoVo = wmsWarehouseRackFeign.selHouseInfoByFullCode(appFirstShelvesGoodsDto.getHouseCode()).getData(); |
|||
wmsInventorySaveDto.setGoodsSpuSid(wmsGoodsTag.getGoodsSpuSid()); |
|||
wmsInventorySaveDto.setGoodsSpuName(wmsGoodsTag.getGoodsSpuName()); |
|||
wmsInventorySaveDto.setGoodsSkuSid(wmsGoodsTag.getGoodsSkuSid()); |
|||
wmsInventorySaveDto.setGoodsSkuTitle(wmsGoodsTag.getGoodsSkuTitle()); |
|||
wmsInventorySaveDto.setGoodsSkuCode(wmsGoodsTag.getGoodsSkuCode()); |
|||
wmsInventorySaveDto.setGoodsSkuOwnSpec(wmsGoodsTag.getGoodsSkuOwnSpec()); |
|||
wmsInventorySaveDto.setUnit(wmsGoodsTag.getUnit()); |
|||
wmsInventorySaveDto.setCount(appFirstShelvesGoodsDto.getCount()); |
|||
wmsInventorySaveDto.setGoodsID(appFirstShelvesGoodsDto.getGoodsID()); |
|||
wmsInventorySaveDto.setManufacturerSid(wmsInitialDetail.getManufacturerSid()); |
|||
wmsInventorySaveDto.setManufacturerName(wmsInitialDetail.getManufacturerName()); |
|||
wmsInventorySaveDto.setFirstInDate(DateUtil.formatDate(wmsInitialDetail.getFirstInDate())); |
|||
wmsInventorySaveDto.setWarehouseSid(wmsHouseInfoVo.getWarehouseSid()); |
|||
wmsInventorySaveDto.setWarehouseName(wmsHouseInfoVo.getWarehouseName()); |
|||
wmsInventorySaveDto.setWarehouseRackSid(wmsHouseInfoVo.getWarehouseRackSid()); |
|||
wmsInventorySaveDto.setWarehouseRackCode(appFirstShelvesGoodsDto.getHouseCode()); |
|||
wmsInventoryFeign.saveWmsInventory(wmsInventorySaveDto).getData(); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
package com.yxt.anrui.terminal.fegin.wmsInventory; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
@Data |
|||
public class WmsInventory extends BaseEntity { |
|||
|
|||
@ApiModelProperty("批次号") |
|||
private String batchNumber; |
|||
@ApiModelProperty("商品ID(唯一编码,入库时生成,生成规则为商品编码+YYMMdd+4位流水)") |
|||
private String goodsID; |
|||
@ApiModelProperty("商品基础信息sid") |
|||
private String goodsSpuSid; |
|||
@ApiModelProperty("商品名称") |
|||
private String goodsSpuName; |
|||
@ApiModelProperty("商品Skusid") |
|||
private String goodsSkuSid; |
|||
@ApiModelProperty("商品Sku名称") |
|||
private String goodsSkuTitle; |
|||
@ApiModelProperty("商品编码(图号)") |
|||
private String goodsSkuCode; |
|||
@ApiModelProperty("规格型号") |
|||
private String goodsSkuOwnSpec; |
|||
@ApiModelProperty("计量单位") |
|||
private String unit; |
|||
@ApiModelProperty("现有量") |
|||
private BigDecimal count; |
|||
@ApiModelProperty("分配量(锁定数量,出库申请通过,但未实际出库)") |
|||
private BigDecimal allocateCount; |
|||
@ApiModelProperty("拣货量") |
|||
private BigDecimal pickCount; |
|||
@ApiModelProperty("冻结量") |
|||
private BigDecimal freezeCount; |
|||
@ApiModelProperty("入库单价") |
|||
private BigDecimal cost; |
|||
@ApiModelProperty("税率") |
|||
private BigDecimal taxRate; |
|||
@ApiModelProperty("仓库sid") |
|||
private String warehouseSid; |
|||
@ApiModelProperty("仓库名称") |
|||
private String warehouseName; |
|||
@ApiModelProperty("库位sid") |
|||
private String warehouseRackSid; |
|||
@ApiModelProperty("库位编码") |
|||
private String warehouseRackCode; |
|||
@ApiModelProperty("首次入库日期-计算库龄的依据") |
|||
private Date firstInDate; |
|||
@ApiModelProperty("创建组织sid") |
|||
private String createOrgSid; |
|||
@ApiModelProperty("使用组织sid") |
|||
private String useOrgSid; |
|||
@ApiModelProperty("厂家订单号") |
|||
private String manufactorBillNo; |
|||
@ApiModelProperty("厂家sid") |
|||
private String manufacturerSid; // 库位sid
|
|||
@ApiModelProperty("厂家名称") |
|||
private String manufacturerName; // 库位编号
|
|||
@ApiModelProperty("客户/供应商sid,出库是为客户,入库时为供应商") |
|||
private String supplierSid; |
|||
@ApiModelProperty("客户/供应商名称") |
|||
private String supplierName; |
|||
} |
Loading…
Reference in new issue