成品生产入库修改

highway
chj 1 year ago
parent 5d87f9a24f
commit 7050ed0fdf

@ -97,5 +97,4 @@ public class WmsProductPutController extends BaseController {
return AjaxResult.success(wmsProductPutService.selectWmsProductPutByWorkOrder(workOrder));
}
}

@ -36,7 +36,7 @@ public class WmsProductPutTrayController extends BaseController {
/**
*
*/
@RequiresPermissions("wms:tray:list")
// @RequiresPermissions("wms:tray:list")
@GetMapping("/list")
public TableDataInfo list(WmsProductPutTray wmsProductPutTray) {
startPage();
@ -69,7 +69,7 @@ public class WmsProductPutTrayController extends BaseController {
*
*
*/
@RequiresPermissions("wms:tray:add")
// @RequiresPermissions("wms:tray:add")
@Log(title = "成品生产入库关联托盘", businessType = BusinessType.INSERT)
@PostMapping("/insertTary")
public AjaxResult add(@RequestBody WmsProductPutTray wmsProductPutTray) {
@ -107,8 +107,18 @@ public class WmsProductPutTrayController extends BaseController {
/**
*
*/
@PostMapping("/handPut")
@PostMapping("/wms/handPut")
public AjaxResult insertWmsProductPutTrays(@RequestBody List<WmsProductPutTray> wmsProductPutTrays){
return toAjax(wmsProductPutTrayService.insertWmsProductPutTrays(wmsProductPutTrays));
}
/**
*
* @param workOrder
* @return
*/
@GetMapping("/listTary/{workOrder}")
public AjaxResult selectWmsProductPutTraysWorkOrder(@PathVariable("workOrder") String workOrder){
return AjaxResult.success(wmsProductPutTrayService.selectWmsProductPutTraysWorkOrder(workOrder));
}
}

@ -56,9 +56,9 @@ public class WmsFpStorageNewsSn extends BaseEntity {
@Excel(name = "数量")
private BigDecimal amount;
/** 备用1 */
@Excel(name = "备用1")
private String userDefined1;
/** 批次号 */
@Excel(name = "批次号")
private String batchNumber;
/** 备用2 */
@Excel(name = "备用2")
@ -192,12 +192,12 @@ public class WmsFpStorageNewsSn extends BaseEntity {
public BigDecimal getAmount() {
return amount;
}
public void setUserDefined1(String userDefined1) {
this.userDefined1 = userDefined1;
public void setBatchNumber(String batchNumber) {
this.batchNumber = batchNumber;
}
public String getUserDefined1() {
return userDefined1;
public String getBatchNumber() {
return batchNumber;
}
public void setUserDefined2(String userDefined2) {
this.userDefined2 = userDefined2;
@ -318,7 +318,7 @@ public class WmsFpStorageNewsSn extends BaseEntity {
.append("sn", getSn())
.append("barCode", getBarCode())
.append("amount", getAmount())
.append("userDefined1", getUserDefined1())
.append("batchNumber", getBatchNumber())
.append("userDefined2", getUserDefined2())
.append("userDefined3", getUserDefined3())
.append("userDefined4", getUserDefined4())

@ -66,4 +66,12 @@ public interface WmsFpStorageNewsSnMapper {
* @return
*/
public WmsFpStorageNewsSn selectWmsFpStorageNewsSnBySnAndProductCodeAndWlCode(@Param("productCode") String productCode, @Param("sn") String sn,@Param("wlCode") String wlCode);
/**
*
* @param sn
* @param productCode
* @return
*/
public WmsFpStorageNewsSn selectWmsFpStorageNewsSnBySnAndProductCode(@Param("sn") String sn,@Param("productCode") String productCode);
}

@ -66,6 +66,11 @@ public interface WmsProductPutTrayCodeMapper {
*/
public WmsProductPutTrayCode selectWmsProductPutTrayCodeBySn(String sn);
/**
*
*/
public List<WmsProductPutTrayCode> selectWmsProductPutTrayCodeBySn1(String sn);
/**
*
* @param barcode

@ -67,4 +67,11 @@ public interface IWmsProductPutTrayService {
*
*/
public int insertWmsProductPutTrays(List<WmsProductPutTray> wmsProductPutTrays);
/**
*
* @param workOrder
* @return
*/
public List<WmsProductPutTray> selectWmsProductPutTraysWorkOrder(String workOrder);
}

@ -3,6 +3,7 @@ package com.op.wms.service.impl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.wms.mapper.WmsFpStorageNewsMapper;

@ -4,6 +4,7 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.wms.domain.WmsProductPutTray;
import com.op.wms.domain.WmsProductPutTrayCode;
@ -108,8 +109,10 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
*
*/
@Override
@DS("#header.poolName")
// @DS("#header.poolName")
public WmsProductPut selectWmsProductPutByWorkOrder(String workOrder) {
//todo 需要修改
DynamicDataSourceContextHolder.push("ds_1000");
/**
*
*/

@ -8,6 +8,7 @@ import java.util.Random;
import com.alibaba.nacos.common.utils.UuidUtils;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.exception.ServiceException;
import com.op.common.core.utils.uuid.IdUtils;
@ -62,8 +63,10 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
* @return
*/
@Override
@DS("#header.poolName")
// @DS("#header.poolName")
public List<WmsProductPutTray> selectWmsProductPutTrayList(WmsProductPutTray wmsProductPutTray) {
//todo 需要修改
DynamicDataSourceContextHolder.push("ds_1000");
return wmsProductPutTrayMapper.selectWmsProductPutTrayList(wmsProductPutTray);
}
@ -74,21 +77,26 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
* @return
*/
@Override
@DS("#header.poolName")
// @DS("#header.poolName")
public int insertWmsProductPutTray(WmsProductPutTray wmsProductPutTray) {
WmsProductPutTrayCode wmsProductPutTrayCode = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn(wmsProductPutTray.getSn());
if (wmsProductPutTrayCode.getRelatStatus().equals("0")){
ValueOperations<String, String> valueOperations = redisTemplate.opsForValue();
String workOrder = valueOperations.get("workOrder");
WmsProductPut wmsProductPut = wmsProductPutMapper.selectWmsProductPutByWorkOrder(workOrder);
wmsProductPutTray.setStorageId(IdUtils.fastSimpleUUID());
wmsProductPutTray.setWorkOrder(workOrder);
wmsProductPutTray.setProductOrder(wmsProductPut.getProductOrder());
wmsProductPutTray.setWhCode(wmsProductPut.getWhCode());
wmsProductPutTray.setWaCode(wmsProductPut.getWaCode());
wmsProductPutTray.setBatchNumber(wmsProductPut.getBatchNumber());
}else {
throw new ServiceException("该托盘已经被占用!");
//todo 需要修改
DynamicDataSourceContextHolder.push("ds_1000");
// WmsProductPutTrayCode wmsProductPutTrayCode = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn(wmsProductPutTray.getSn());
List<WmsProductPutTrayCode> wmsProductPutTrayCodes = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn1(wmsProductPutTray.getSn());
ValueOperations<String, String> valueOperations = redisTemplate.opsForValue();
String workOrder = valueOperations.get("workOrder");
WmsProductPut wmsProductPut = wmsProductPutMapper.selectWmsProductPutByWorkOrder(workOrder);
for (WmsProductPutTrayCode wmsProductPutTrayCode : wmsProductPutTrayCodes) {
if (wmsProductPutTrayCode.getRelatStatus().equals("0")){
wmsProductPutTray.setStorageId(IdUtils.fastSimpleUUID());
wmsProductPutTray.setWorkOrder(workOrder);
wmsProductPutTray.setProductOrder(wmsProductPut.getProductOrder());
wmsProductPutTray.setWhCode(wmsProductPut.getWhCode());
wmsProductPutTray.setWaCode(wmsProductPut.getWaCode());
wmsProductPutTray.setBatchNumber(wmsProductPut.getBatchNumber());
}else {
throw new ServiceException("该托盘已经被占用!");
}
}
return wmsProductPutTrayMapper.insertWmsProductPutTray(wmsProductPutTray);
}
@ -135,8 +143,10 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
*
*/
@Override
@DS("#header.poolName")
// @DS("#header.poolName")
public int deleteWmsProductPutTrayBySn(String sn, String workOrder) {
//todo 需要修改
DynamicDataSourceContextHolder.push("ds_1000");
return wmsProductPutTrayMapper.deleteWmsProductPutTrayBySn(sn,workOrder);
}
@ -145,8 +155,11 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
*
*/
@Override
@DS("#header.poolName")
// @DS("#header.poolName")
public int insertWmsProductPutTrays(List<WmsProductPutTray> wmsProductPutTrays){
//todo 需要修改
DynamicDataSourceContextHolder.push("ds_1000");
ValueOperations<String,String> valueOperations = redisTemplate.opsForValue();
String workOrder = valueOperations.get("workOrder");
WmsProductPut wmsProductPut = wmsProductPutMapper.selectWmsProductPutByWorkOrder(workOrder);
@ -170,7 +183,7 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
wmsFpStorageNewsMapper.insertWmsFpStorageNews(wmsFpStorageNews1);
}else {
//加库存数量
BigDecimal putQuantity = new BigDecimal(wmsProductPutTray.getNumber());
BigDecimal putQuantity = new BigDecimal(wmsProductPut.getPutQuantity());
wmsFpStorageNews.setAmount(wmsFpStorageNews.getAmount().add(putQuantity));
wmsFpStorageNews.setUpdateBy(SecurityContextHolder.getUserName());
wmsFpStorageNews.setUpdateTime(new Date());
@ -201,7 +214,7 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
// wmsFpStorageNews.setUpdateTime(new Date());
// wmsFpStorageNewsMapper.updateWmsFpStorageNews(wmsFpStorageNews);
// }
//生成库存明细
//todo 生成库存明细
for (WmsProductPutTray wmsProductPutTray : wmsProductPutTrays) {
WmsFpStorageNewsSn wmsFpStorageNewsSn1 = wmsFpStorageNewsSnMapper.selectWmsFpStorageNewsSnBySnAndProductCodeAndWlCode(wmsProductPut.getProductCode(), wmsProductPutTray.getSn(), wmsProductPutTray.getWlCode());
WmsFpStorageNewsSn wmsFpStorageNewsSn = new WmsFpStorageNewsSn();
@ -210,7 +223,7 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
wmsFpStorageNewsSn.setWhCode(wmsProductPut.getWhCode());
wmsFpStorageNewsSn.setWaCode(wmsProductPut.getWaCode());
wmsFpStorageNewsSn.setWlCode(wmsProductPutTray.getWlCode());
wmsFpStorageNewsSn.setOrderNo(IdUtils.fastSimpleUUID());
// wmsFpStorageNewsSn.setOrderNo(IdUtils.fastSimpleUUID());
wmsFpStorageNewsSn.setProductName(wmsProductPut.getProductName());
wmsFpStorageNewsSn.setProductCode(wmsProductPut.getProductCode());
wmsFpStorageNewsSn.setSn(wmsProductPutTray.getSn());
@ -218,6 +231,7 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
wmsFpStorageNewsSn.setAmount(number);
wmsFpStorageNewsSn.setCreateBy(SecurityContextHolder.getUserName());
wmsFpStorageNewsSn.setCreateTime(new Date());
wmsFpStorageNewsSn.setBatchNumber(wmsProductPutTray.getBatchNumber());
wmsFpStorageNewsSnMapper.insertWmsFpStorageNewsSn(wmsFpStorageNewsSn);
}else {
//加库存数量
@ -251,11 +265,29 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
}
//todo 增加托盘上的数量
for (WmsProductPutTray wmsProductPutTray : wmsProductPutTrays) {
WmsProductPutTrayCode wmsProductPutTrayCode = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn(wmsProductPutTray.getSn());
wmsProductPutTrayCode.setRelatStatus("1");
wmsProductPutTrayCode.setNumber(wmsProductPutTrayCode.getNumber()+Integer.parseInt(wmsProductPutTray.getNumber()));
wmsProductPutTrayCodeMapper.updateWmsProductPutTrayCode(wmsProductPutTrayCode);
//WmsProductPutTrayCode wmsProductPutTrayCode = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn(wmsProductPutTray.getSn());
List<WmsProductPutTrayCode> wmsProductPutTrayCodes = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn1(wmsProductPutTray.getSn());
for (WmsProductPutTrayCode productPutTrayCode : wmsProductPutTrayCodes) {
productPutTrayCode.setRelatStatus("1");
productPutTrayCode.setNumber(productPutTrayCode.getNumber()+Integer.parseInt(wmsProductPutTray.getNumber()));
wmsProductPutTrayCodeMapper.updateWmsProductPutTrayCode(productPutTrayCode);
}
// wmsProductPutTrayCode.setRelatStatus("1");
// wmsProductPutTrayCode.setNumber(wmsProductPutTrayCode.getNumber()+Integer.parseInt(wmsProductPutTray.getNumber()));
// wmsProductPutTrayCodeMapper.updateWmsProductPutTrayCode(wmsProductPutTrayCode);
}
return 1;
}
/**
*
* @param workOrder
* @return
*/
@Override
public List<WmsProductPutTray> selectWmsProductPutTraysWorkOrder(String workOrder) {
//todo 需要修改
DynamicDataSourceContextHolder.push("ds_1000");
return wmsProductPutTrayMapper.selectWmsProductPutTrayByWorkOrder(workOrder);
}
}

@ -15,7 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="sn" column="sn" />
<result property="barCode" column="bar_code" />
<result property="amount" column="amount" />
<result property="userDefined1" column="user_defined1" />
<result property="batchNumber" column="batch_number" />
<result property="userDefined2" column="user_defined2" />
<result property="userDefined3" column="user_defined3" />
<result property="userDefined4" column="user_defined4" />
@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWmsFpStorageNewsSnVo">
select storage_id, wh_code, wa_code, wl_code, order_no, product_name, product_code, sn, bar_code, amount, user_defined1, user_defined2, user_defined3, user_defined4, user_defined5, user_defined6, user_defined7, user_defined8, user_defined9, user_defined10, create_by, gmt_create, last_modified_by, gmt_modified, active_flag, factory_code, sap_factory_code from wms_fp_storage_news_sn
select storage_id, wh_code, wa_code, wl_code, order_no, product_name, product_code, sn, bar_code, amount, batch_number, user_defined2, user_defined3, user_defined4, user_defined5, user_defined6, user_defined7, user_defined8, user_defined9, user_defined10, create_by, gmt_create, last_modified_by, gmt_modified, active_flag, factory_code, sap_factory_code from wms_fp_storage_news_sn
</sql>
<select id="selectWmsFpStorageNewsSnList" parameterType="WmsFpStorageNewsSn" resultMap="WmsFpStorageNewsSnResult">
@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sn != null and sn != ''"> and sn = #{sn}</if>
<if test="barCode != null and barCode != ''"> and bar_code = #{barCode}</if>
<if test="amount != null "> and amount = #{amount}</if>
<if test="userDefined1 != null and userDefined1 != ''"> and user_defined1 = #{userDefined1}</if>
<if test="batchNumber != null and batchNumber != ''"> and batch_number = #{batchNumber}</if>
<if test="userDefined2 != null and userDefined2 != ''"> and user_defined2 = #{userDefined2}</if>
<if test="userDefined3 != null and userDefined3 != ''"> and user_defined3 = #{userDefined3}</if>
<if test="userDefined4 != null and userDefined4 != ''"> and user_defined4 = #{userDefined4}</if>
@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
product_name,
sap_factory_code,
storage_id,
user_defined1,
batch_number,
user_defined10,
user_defined2,
user_defined3,
@ -106,6 +106,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
product_code = #{productCode} AND
sn = #{sn} and wl_code = #{wlCode}
</select>
<!-- 根据托盘号和产品编码查询-->
<select id="selectWmsFpStorageNewsSnBySnAndProductCode" resultMap="WmsFpStorageNewsSnResult">
SELECT
active_flag,
amount,
bar_code,
create_by,
factory_code,
gmt_create,
gmt_modified,
last_modified_by,
order_no,
product_name,
sap_factory_code,
storage_id,
batch_number,
user_defined10,
user_defined2,
user_defined3,
user_defined4,
user_defined5,
user_defined6,
user_defined7,
user_defined8,
user_defined9,
wa_code,
wh_code,
wl_code
FROM
wms_fp_storage_news_sn
WHERE
product_code = #{productCode} AND
sn = #{sn}
</select>
<insert id="insertWmsFpStorageNewsSn" parameterType="WmsFpStorageNewsSn">
insert into wms_fp_storage_news_sn
@ -120,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sn != null">sn,</if>
<if test="barCode != null">bar_code,</if>
<if test="amount != null">amount,</if>
<if test="userDefined1 != null">user_defined1,</if>
<if test="batchNumber != null">batch_number,</if>
<if test="userDefined2 != null">user_defined2,</if>
<if test="userDefined3 != null">user_defined3,</if>
<if test="userDefined4 != null">user_defined4,</if>
@ -149,7 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sn != null">#{sn},</if>
<if test="barCode != null">#{barCode},</if>
<if test="amount != null">#{amount},</if>
<if test="userDefined1 != null">#{userDefined1},</if>
<if test="batchNumber != null">#{batchNumber},</if>
<if test="userDefined2 != null">#{userDefined2},</if>
<if test="userDefined3 != null">#{userDefined3},</if>
<if test="userDefined4 != null">#{userDefined4},</if>
@ -181,7 +215,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sn != null">sn = #{sn},</if>
<if test="barCode != null">bar_code = #{barCode},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="userDefined1 != null">user_defined1 = #{userDefined1},</if>
<if test="batchNumber != null">batch_number = #{batchNumber},</if>
<if test="userDefined2 != null">user_defined2 = #{userDefined2},</if>
<if test="userDefined3 != null">user_defined3 = #{userDefined3},</if>
<if test="userDefined4 != null">user_defined4 = #{userDefined4},</if>

@ -59,9 +59,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
barcode = #{barcode}
</select>
<select id="selectWmsProductPutTrayCodeBySn1" resultMap="WmsProductPutTrayCodeResult">
SELECT
storage_id,barcode,number,relat_status,storage_id,user_defined1,user_defined2,user_defined3,user_defined4,user_defined5
FROM
wms_product_put_tray_code
WHERE
sn = #{sn}
</select>
<insert id="insertWmsProductPutTrayCode" parameterType="WmsProductPutTrayCode">
<insert id="insertWmsProductPutTrayCode" parameterType="WmsProductPutTrayCode">
insert into wms_product_put_tray_code
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storageId != null">storage_id,</if>

Loading…
Cancel
Save