|
|
@ -17,9 +17,14 @@ import com.yxt.wms.biz.base.wmswarehouseextend.WmsWarehouseExtendVo; |
|
|
|
import com.yxt.wms.feign.portal.privilege.PrivilegeQuery; |
|
|
|
import com.yxt.wms.feign.portal.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.wms.feign.portal.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.wms.feign.portal.sysstaffinfo.RoleCodeListQuery; |
|
|
|
import com.yxt.wms.feign.portal.sysstaffinfo.StaffByRole; |
|
|
|
import com.yxt.wms.feign.portal.sysstaffinfo.SysStaffinfoFeign; |
|
|
|
import com.yxt.wms.feign.portal.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.wms.feign.portal.sysuser.SysUserFeign; |
|
|
|
import com.yxt.wms.utils.BillNo; |
|
|
|
import com.yxt.wms.utils.OrgPathQuery; |
|
|
|
import com.yxt.wms.utils.Rule; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -45,6 +50,8 @@ public class WmsWarehouseInfoService extends MybatisBaseService<WmsWarehouseInfo |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
@Autowired |
|
|
|
private SysStaffOrgFeign sysStaffOrgFeign; |
|
|
|
@Autowired |
|
|
|
private SysStaffinfoFeign sysStaffinfoFeign; |
|
|
|
|
|
|
|
public ResultBean<PagerVo<WmsWarehouseInfoVo>> listPage(PagerQuery<WmsWarehouseInfoQuery> pq) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
@ -131,18 +138,7 @@ public class WmsWarehouseInfoService extends MybatisBaseService<WmsWarehouseInfo |
|
|
|
WmsWarehouseInfo wmsWarehouse = fetchBySid(dto.getSid()); |
|
|
|
BeanUtil.copyProperties(dto, wmsWarehouse, "id", "sid"); |
|
|
|
wmsWarehouse.setModifyTime(new Date()); |
|
|
|
WmsWarehouseInfo warehouseInfo = baseMapper.checkCodeForUpdate(dto.getWarehouseCode(), wmsWarehouse.getUseOrgSid(), sid); |
|
|
|
if (warehouseInfo != null) { |
|
|
|
return rb.setMsg("仓库编码重复"); |
|
|
|
} |
|
|
|
baseMapper.updateById(wmsWarehouse); |
|
|
|
// for (WmsWarehouseExtendDto wmsWarehouseExtendDto : dto.getWmsWarehouseExtendDtos()) {
|
|
|
|
// wmsWarehouseExtendDto.setWarehouseSid(wmsWarehouse.getSid());
|
|
|
|
// }
|
|
|
|
// if(dto.getWmsWarehouseExtendDto()!=null){
|
|
|
|
// dto.getWmsWarehouseExtendDto().setWarehouseSid(wmsWarehouse.getSid());
|
|
|
|
// wmsWarehouseExtendService.saveOrUpdate(dto.getWmsWarehouseExtendDto());
|
|
|
|
// }
|
|
|
|
} else { |
|
|
|
WmsWarehouseInfo wmsWarehouse = new WmsWarehouseInfo(); |
|
|
|
sid = wmsWarehouse.getSid(); |
|
|
@ -152,6 +148,8 @@ public class WmsWarehouseInfoService extends MybatisBaseService<WmsWarehouseInfo |
|
|
|
String deptName = ""; |
|
|
|
String deptSid = ""; |
|
|
|
String createOrgSid = ""; |
|
|
|
String deptNo = ""; |
|
|
|
String useOrgNo = ""; |
|
|
|
if (StringUtils.isNotBlank(orgPath)) { |
|
|
|
List<String> split = Arrays.asList(orgPath.split("/")); |
|
|
|
if (split.size() > 1) { |
|
|
@ -161,11 +159,13 @@ public class WmsWarehouseInfoService extends MybatisBaseService<WmsWarehouseInfo |
|
|
|
deptName = sysOrganization.getName() + "/" + sysOrganization1.getName(); |
|
|
|
deptName = sysOrganization1.getName(); |
|
|
|
deptSid = sysOrganization1.getSid(); |
|
|
|
deptNo = sysOrganization1.getOrgCode(); |
|
|
|
} else { |
|
|
|
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(split.get(0)).getData(); |
|
|
|
deptName = sysOrganization.getName(); |
|
|
|
deptName = sysOrganization.getName(); |
|
|
|
deptSid = sysOrganization.getSid(); |
|
|
|
deptNo = sysOrganization.getOrgCode(); |
|
|
|
} |
|
|
|
wmsWarehouse.setUseOrgSid(deptSid); |
|
|
|
createOrgSid = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData(); |
|
|
@ -173,26 +173,31 @@ public class WmsWarehouseInfoService extends MybatisBaseService<WmsWarehouseInfo |
|
|
|
ResultBean<SysOrganizationVo> organizationResultBean = sysOrganizationFeign.fetchBySid(createOrgSid); |
|
|
|
if (organizationResultBean.getData() != null) { |
|
|
|
wmsWarehouse.setCreateOrgSid(createOrgSid); |
|
|
|
useOrgNo = organizationResultBean.getData().getOrgCode(); |
|
|
|
} |
|
|
|
} |
|
|
|
WmsWarehouseInfo warehouseInfo = baseMapper.checkCode(dto.getWarehouseCode(), deptSid); |
|
|
|
if (warehouseInfo != null) { |
|
|
|
return rb.setMsg("仓库编码重复"); |
|
|
|
//生成编码
|
|
|
|
String billCode = useOrgNo + deptNo; |
|
|
|
String applyCode = getApplyCode(billCode); |
|
|
|
wmsWarehouse.setWarehouseCode(applyCode); |
|
|
|
} |
|
|
|
baseMapper.insert(wmsWarehouse); |
|
|
|
// for (WmsWarehouseExtendDto wmsWarehouseExtendDto : dto.getWmsWarehouseExtendDtos()) {
|
|
|
|
// wmsWarehouseExtendDto.setWarehouseSid(wmsWarehouse.getSid());
|
|
|
|
// }
|
|
|
|
// if(dto.getWmsWarehouseExtendDto()!=null){
|
|
|
|
// dto.getWmsWarehouseExtendDto().setWarehouseSid(wmsWarehouse.getSid());
|
|
|
|
// wmsWarehouseExtendService.saveOrUpdate(dto.getWmsWarehouseExtendDto());
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setMsg("成功"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成单据编号 |
|
|
|
* |
|
|
|
* @param billCode |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public String getApplyCode(String billCode) { |
|
|
|
int i = baseMapper.selectNum(billCode); |
|
|
|
String billNo = Rule.getBillNo3(billCode, i); |
|
|
|
return billNo; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<WmsWarehouseInfoVo> initialization(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
WmsWarehouseInfoVo vo = new WmsWarehouseInfoVo(); |
|
|
@ -237,4 +242,24 @@ public class WmsWarehouseInfoService extends MybatisBaseService<WmsWarehouseInfo |
|
|
|
public List<WmsWarehouseAreaAllVo> selectAll() { |
|
|
|
return baseMapper.selectAll(); |
|
|
|
} |
|
|
|
|
|
|
|
public List<MangerVo> selMangerByRole(String createOrgSid) { |
|
|
|
RoleCodeListQuery query = new RoleCodeListQuery(); |
|
|
|
List<String> roleCode = new ArrayList<>(); |
|
|
|
List<MangerVo> list = new ArrayList<>(); |
|
|
|
roleCode.add("74"); |
|
|
|
roleCode.add("75"); |
|
|
|
roleCode.add("76"); |
|
|
|
query.setCreateOrgSid(createOrgSid); |
|
|
|
List<StaffByRole> data = sysStaffinfoFeign.getStaffNameByRoleCode(query).getData(); |
|
|
|
if (!data.isEmpty()) { |
|
|
|
for (StaffByRole datum : data) { |
|
|
|
MangerVo vo = new MangerVo(); |
|
|
|
vo.setName(datum.getManager()); |
|
|
|
vo.setSid(datum.getManagerSid()); |
|
|
|
list.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
} |
|
|
|