Compare commits

...

6 Commits

8 changed files with 125 additions and 10 deletions

View File

@ -8,7 +8,7 @@ spring:
master:
# url: jdbc:dm://30.30.2.24:5237/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:dm://localhost:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:dm://8.218.31.53:7069/WMS_GJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:dm://abca.xin:7069/WMS_GJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA001
# 从库数据源
@ -61,7 +61,7 @@ spring:
# redis 配置
redis:
# 地址
host: 8.218.31.53
host: abca.xin
# 端口默认为6379
port: 7067
# 数据库索引
@ -83,10 +83,10 @@ spring:
#Mino配置
minio:
url: http://8.218.31.53:7068
url: http://abca.xin:7068
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-dj
bucketName: wms-gj
# 远程读取文件
globalConfig:

View File

@ -8,14 +8,19 @@ import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.domain.dto.WmsOutboundOrderDto;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.IWmsBusinessTypeService;
import com.ktg.mes.md.service.IWmsOutPlanService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -27,9 +32,11 @@ import java.util.List;
*/
@RestController
@RequestMapping("/md/PLAN")
@RequiredArgsConstructor
public class WmsOutPlanController extends BaseController {
@Autowired
private IWmsOutPlanService wmsOutPlanService;
private final IWmsOutPlanService wmsOutPlanService;
private final IWmsBusinessTypeService wmsBusinessTypeService;
private final IMdItemService mdItemService;
/**
* 查询出库计划管理列表
@ -50,6 +57,66 @@ public class WmsOutPlanController extends BaseController {
return toAjax(wmsOutPlanService.insertWmsOutPlanAndRun(wmsOutPlan));
}
/**
* 订单生成出库计划
* @param wmsOutboundOrderDto
* @return
*/
@PostMapping("/open/order/add")
public AjaxResult openOrderAdd(@RequestBody @Valid WmsOutboundOrderDto wmsOutboundOrderDto) {
// 查询业务类型
WmsBusinessType wmsBusinessType = wmsBusinessTypeService.selectWmsBusinessTypeByCode(wmsOutboundOrderDto.getTypeCode());
if (wmsBusinessType == null) {
return AjaxResult.error("出库类型编码错误:" + wmsOutboundOrderDto.getTypeCode());
}
// 查询物料信息
MdItem mdItem = mdItemService.selectMdItemByCode(wmsOutboundOrderDto.getMaterialCode());
if (mdItem == null) {
return AjaxResult.error("物料编码错误:" + wmsOutboundOrderDto.getMaterialCode());
}
// 创建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
wmsOutPlan.setWmsBusinessTypeId(wmsBusinessType.getTypeId());
wmsOutPlan.setWmsBusinessType(wmsBusinessType);
wmsOutPlan.setPlanType("SGLR");
wmsOutPlan.setPlanState("0");
wmsOutPlan.setRemark("订单号: " + wmsOutboundOrderDto.getOrderId());
// 创建出库计划明细
ArrayList<WmsOutPlanDetail> wmsOutPlanDetails = getWmsOutPlanDetails(wmsOutboundOrderDto, mdItem);
wmsOutPlan.setWmsOutPlanDetailList(wmsOutPlanDetails);
// 插入出库计划并执行
try {
int i = wmsOutPlanService.insertWmsOutPlanAndRun(wmsOutPlan);
if (i > 0) {
return AjaxResult.success("出库任务创建成功");
} else {
return AjaxResult.error("出库任务创建失败,原因:数据库插入失败");
}
} catch (Exception e) {
return AjaxResult.error("出库任务创建失败,原因:" + e.getMessage());
}
}
private static ArrayList<WmsOutPlanDetail> getWmsOutPlanDetails(WmsOutboundOrderDto wmsOutboundOrderDto, MdItem mdItem) {
WmsOutPlanDetail wmsOutPlanDetail = new WmsOutPlanDetail();
wmsOutPlanDetail.setMdItemId(mdItem.getItemId());
wmsOutPlanDetail.setMdItemName(mdItem.getItemName());
wmsOutPlanDetail.setMdItemCode(mdItem.getItemCode());
wmsOutPlanDetail.setMdItemUnit(mdItem.getUnitName());
wmsOutPlanDetail.setPlannedQuantity(wmsOutboundOrderDto.getQuantity());
wmsOutPlanDetail.setRealQuantity(wmsOutboundOrderDto.getQuantity());
wmsOutPlanDetail.setDetailBatchNum(wmsOutboundOrderDto.getOrderId());
wmsOutPlanDetail.setDetailState("0");
ArrayList<WmsOutPlanDetail> wmsOutPlanDetails = new ArrayList<>();
wmsOutPlanDetails.add(wmsOutPlanDetail);
return wmsOutPlanDetails;
}
/**
* 查询出库计划管理列表
*/

View File

@ -0,0 +1,27 @@
package com.ktg.mes.md.domain.dto;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
// 根据订单出库
@Getter
@Setter
public class WmsOutboundOrderDto {
// 订单号
@NotBlank(message = "订单号不能为空")
private String orderId;
// 物料编码
@NotBlank(message = "物料编码不能为空")
private String materialCode;
// 出库类型编码
@NotBlank(message = "出库类型编码不能为空")
private String typeCode;
// 出库数量
@NotNull(message = "出库数量不能为空")
@Min(value = 1, message = "数量必须大于等于 1")
private int quantity;
}

View File

@ -19,6 +19,14 @@ public interface IWmsBusinessTypeService
*/
public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId);
/**
* 查询出入库类型
*
* @param code 出入库类型编码
* @return 出入库类型
*/
public WmsBusinessType selectWmsBusinessTypeByCode(String code);
/**
* 查询出入库类型列表
*

View File

@ -32,6 +32,18 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
return wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(typeId);
}
/**
* 查询出入库类型
*
* @param code 出入库类型编码
* @return 出入库类型
*/
@Override
public WmsBusinessType selectWmsBusinessTypeByCode(String code) {
return wmsBusinessTypeMapper.selectWmsBusinessTypeByCode(code);
}
/**
* 查询出入库类型列表
*

View File

@ -314,7 +314,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
// 构建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId()) : 14L);
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() : 14L);
wmsOutPlan.setPlanState("1");
wmsOutPlan.setPlanType("SGLR");
wmsOutPlan.setRemark("一键清退无寿命物品");

View File

@ -555,6 +555,7 @@
<select id="selectBaseKnifeListByMbbBdMrlIdAndKnifeFineStateAndIsLocked" resultMap="BaseKnifeResult">
<include refid="selectBaseKnifeVo"/>
<where>
IS_VALID = 0
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
and MBB_BD_MRL_ID = #{mbbBdMrlId}
</if>

View File

@ -109,7 +109,7 @@
</if>
and IS_DELETE = 0
</where>
ORDER BY AREA_CODE ASC
ORDER BY attr2 ASC
</select>
<select id="selectWmStorageAreaListVo" parameterType="AreaVo" resultMap="WmStorageAreaVoResult">