Merge remote-tracking branch 'origin/master'

This commit is contained in:
汤锦科 2024-11-01 10:38:20 +08:00
commit 7a04c9748d
8 changed files with 1149 additions and 2 deletions

View File

@ -0,0 +1,104 @@
package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.service.IWmsInPlanService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 入库计划Controller
*
* @author yinjinlu
* @date 2024-10-31
*/
@RestController
@RequestMapping("/wm/PLAN")
public class WmsInPlanController extends BaseController
{
@Autowired
private IWmsInPlanService wmsInPlanService;
/**
* 查询入库计划列表
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:list')")
@GetMapping("/list")
public TableDataInfo list(WmsInPlan wmsInPlan)
{
startPage();
List<WmsInPlan> list = wmsInPlanService.selectWmsInPlanList(wmsInPlan);
return getDataTable(list);
}
/**
* 导出入库计划列表
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:export')")
@Log(title = "入库计划", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WmsInPlan wmsInPlan)
{
List<WmsInPlan> list = wmsInPlanService.selectWmsInPlanList(wmsInPlan);
ExcelUtil<WmsInPlan> util = new ExcelUtil<WmsInPlan>(WmsInPlan.class);
util.exportExcel(response, list, "入库计划数据");
}
/**
* 获取入库计划详细信息
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:query')")
@GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") String planId)
{
return AjaxResult.success(wmsInPlanService.selectWmsInPlanByPlanId(planId));
}
/**
* 新增入库计划
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:add')")
@Log(title = "入库计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsInPlan wmsInPlan)
{
return toAjax(wmsInPlanService.insertWmsInPlan(wmsInPlan));
}
/**
* 修改入库计划
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:edit')")
@Log(title = "入库计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmsInPlan wmsInPlan)
{
return toAjax(wmsInPlanService.updateWmsInPlan(wmsInPlan));
}
/**
* 删除入库计划
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:remove')")
@Log(title = "入库计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable String[] planIds)
{
return toAjax(wmsInPlanService.deleteWmsInPlanByPlanIds(planIds));
}
}

View File

@ -0,0 +1,365 @@
package com.ktg.mes.wm.domain;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
/**
* 入库计划对象 WMS_IN_PLAN
*
* @author yinjinlu
* @date 2024-10-31
*/
public class WmsInPlan extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String planId;
/** 状态[00-新建 20-执行中 40-关闭 45-手工关闭] */
@Excel(name = "状态[00-新建 20-执行中 40-关闭 45-手工关闭]")
private String state;
/** 来源类型[10-接口 20-手工 30-导入] */
@Excel(name = "来源类型[10-接口 20-手工 30-导入]")
private String sourceType;
/** 仓库ID */
@Excel(name = "仓库ID")
private String wareId;
/** 库位编码 */
@Excel(name = "库位编码")
private String cellCode;
/** 工单号 */
@Excel(name = "工单号")
private String workOrderCode;
/** 计划日期 */
@Excel(name = "计划日期")
private String expectDate;
/** 发布人 */
@Excel(name = "发布人")
private String publishName;
/** 发布时间 */
@Excel(name = "发布时间")
private String publishTime;
/** 关闭人(暂不可用) */
@Excel(name = "关闭人(暂不可用)")
private String closerId;
/** 关闭日期(暂不可用) */
@Excel(name = "关闭日期(暂不可用)")
private String closeTime;
/** 关联单据号 */
@Excel(name = "关联单据号")
private String relBillCode;
/** 客户ID. */
@Excel(name = "客户ID.")
private String customerId;
/** 采购单号. */
@Excel(name = "采购单号.")
private String poCode;
/** 部门ID. */
@Excel(name = "部门ID.")
private String departmentId;
/** 合同号. */
@Excel(name = "合同号.")
private String contractNo;
/** 供应商ID. */
@Excel(name = "供应商ID.")
private String supplierId;
/** 业务类型id. */
@Excel(name = "业务类型id.")
private String businessTypeId;
/** 来源出库任务. */
@Excel(name = "来源出库任务.")
private String srcOutTaskId;
/** 激活标识(0激活1冻结) */
@Excel(name = "激活标识(0激活1冻结)")
private String isActive;
/** 删除标识(0未删除1删除) */
@Excel(name = "删除标识(0未删除1删除)")
private String isDelete;
/** 计划编码 */
@Excel(name = "计划编码")
private String planCode;
/** 入库类型 */
@Excel(name = "入库类型")
private String planTypeId;
/** 入库计划明细信息 */
private List<WmsInPlanDetails> wmsInPlanDetailsList;
public void setPlanId(String planId)
{
this.planId = planId;
}
public String getPlanId()
{
return planId;
}
public void setState(String state)
{
this.state = state;
}
public String getState()
{
return state;
}
public void setSourceType(String sourceType)
{
this.sourceType = sourceType;
}
public String getSourceType()
{
return sourceType;
}
public void setWareId(String wareId)
{
this.wareId = wareId;
}
public String getWareId()
{
return wareId;
}
public void setCellCode(String cellCode)
{
this.cellCode = cellCode;
}
public String getCellCode()
{
return cellCode;
}
public void setWorkOrderCode(String workOrderCode)
{
this.workOrderCode = workOrderCode;
}
public String getWorkOrderCode()
{
return workOrderCode;
}
public void setExpectDate(String expectDate)
{
this.expectDate = expectDate;
}
public String getExpectDate()
{
return expectDate;
}
public void setPublishName(String publishName)
{
this.publishName = publishName;
}
public String getPublishName()
{
return publishName;
}
public void setPublishTime(String publishTime)
{
this.publishTime = publishTime;
}
public String getPublishTime()
{
return publishTime;
}
public void setCloserId(String closerId)
{
this.closerId = closerId;
}
public String getCloserId()
{
return closerId;
}
public void setCloseTime(String closeTime)
{
this.closeTime = closeTime;
}
public String getCloseTime()
{
return closeTime;
}
public void setRelBillCode(String relBillCode)
{
this.relBillCode = relBillCode;
}
public String getRelBillCode()
{
return relBillCode;
}
public void setCustomerId(String customerId)
{
this.customerId = customerId;
}
public String getCustomerId()
{
return customerId;
}
public void setPoCode(String poCode)
{
this.poCode = poCode;
}
public String getPoCode()
{
return poCode;
}
public void setDepartmentId(String departmentId)
{
this.departmentId = departmentId;
}
public String getDepartmentId()
{
return departmentId;
}
public void setContractNo(String contractNo)
{
this.contractNo = contractNo;
}
public String getContractNo()
{
return contractNo;
}
public void setSupplierId(String supplierId)
{
this.supplierId = supplierId;
}
public String getSupplierId()
{
return supplierId;
}
public void setBusinessTypeId(String businessTypeId)
{
this.businessTypeId = businessTypeId;
}
public String getBusinessTypeId()
{
return businessTypeId;
}
public void setSrcOutTaskId(String srcOutTaskId)
{
this.srcOutTaskId = srcOutTaskId;
}
public String getSrcOutTaskId()
{
return srcOutTaskId;
}
public void setIsActive(String isActive)
{
this.isActive = isActive;
}
public String getIsActive()
{
return isActive;
}
public void setIsDelete(String isDelete)
{
this.isDelete = isDelete;
}
public String getIsDelete()
{
return isDelete;
}
public void setPlanCode(String planCode)
{
this.planCode = planCode;
}
public String getPlanCode()
{
return planCode;
}
public void setPlanTypeId(String planTypeId)
{
this.planTypeId = planTypeId;
}
public String getPlanTypeId()
{
return planTypeId;
}
public List<WmsInPlanDetails> getWmsInPlanDetailsList()
{
return wmsInPlanDetailsList;
}
public void setWmsInPlanDetailsList(List<WmsInPlanDetails> wmsInPlanDetailsList)
{
this.wmsInPlanDetailsList = wmsInPlanDetailsList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("planId", getPlanId())
.append("state", getState())
.append("sourceType", getSourceType())
.append("wareId", getWareId())
.append("cellCode", getCellCode())
.append("workOrderCode", getWorkOrderCode())
.append("expectDate", getExpectDate())
.append("publishName", getPublishName())
.append("publishTime", getPublishTime())
.append("closerId", getCloserId())
.append("closeTime", getCloseTime())
.append("relBillCode", getRelBillCode())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("remark", getRemark())
.append("customerId", getCustomerId())
.append("poCode", getPoCode())
.append("departmentId", getDepartmentId())
.append("contractNo", getContractNo())
.append("supplierId", getSupplierId())
.append("businessTypeId", getBusinessTypeId())
.append("srcOutTaskId", getSrcOutTaskId())
.append("isActive", getIsActive())
.append("isDelete", getIsDelete())
.append("planCode", getPlanCode())
.append("planTypeId", getPlanTypeId())
.append("wmsInPlanDetailsList", getWmsInPlanDetailsList())
.toString();
}
}

View File

@ -0,0 +1,168 @@
package com.ktg.mes.wm.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
/**
* 入库计划明细对象 WMS_IN_PLAN_DETAILS
*
* @author yinjinlu
* @date 2024-10-31
*/
public class WmsInPlanDetails extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long detailsId;
/** 入库计划ID */
@Excel(name = "入库计划ID")
private String planId;
/** 物料ID */
@Excel(name = "物料ID")
private String materialId;
/** 批次 */
@Excel(name = "批次")
private String batch;
/** 库位 */
@Excel(name = "库位")
private String cellId;
/** 计划数量 */
@Excel(name = "计划数量")
private String quantity;
/** 入库数量 */
@Excel(name = "入库数量")
private String quantityIn;
/** 状态 */
@Excel(name = "状态")
private String planInStatus;
/** 激活标识(0激活1冻结) */
@Excel(name = "激活标识(0激活1冻结)")
private String isActivy;
/** 删除标识(0未删除1删除) */
@Excel(name = "删除标识(0未删除1删除)")
private String isDelete;
public void setDetailsId(Long detailsId)
{
this.detailsId = detailsId;
}
public Long getDetailsId()
{
return detailsId;
}
public void setPlanId(String planId)
{
this.planId = planId;
}
public String getPlanId()
{
return planId;
}
public void setMaterialId(String materialId)
{
this.materialId = materialId;
}
public String getMaterialId()
{
return materialId;
}
public void setBatch(String batch)
{
this.batch = batch;
}
public String getBatch()
{
return batch;
}
public void setCellId(String cellId)
{
this.cellId = cellId;
}
public String getCellId()
{
return cellId;
}
public void setQuantity(String quantity)
{
this.quantity = quantity;
}
public String getQuantity()
{
return quantity;
}
public void setQuantityIn(String quantityIn)
{
this.quantityIn = quantityIn;
}
public String getQuantityIn()
{
return quantityIn;
}
public void setPlanInStatus(String planInStatus)
{
this.planInStatus = planInStatus;
}
public String getPlanInStatus()
{
return planInStatus;
}
public void setIsActivy(String isActivy)
{
this.isActivy = isActivy;
}
public String getIsActivy()
{
return isActivy;
}
public void setIsDelete(String isDelete)
{
this.isDelete = isDelete;
}
public String getIsDelete()
{
return isDelete;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("detailsId", getDetailsId())
.append("planId", getPlanId())
.append("materialId", getMaterialId())
.append("batch", getBatch())
.append("cellId", getCellId())
.append("quantity", getQuantity())
.append("quantityIn", getQuantityIn())
.append("planInStatus", getPlanInStatus())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("isActivy", getIsActivy())
.append("isDelete", getIsDelete())
.toString();
}
}

View File

@ -0,0 +1,87 @@
package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
/**
* 入库计划Mapper接口
*
* @author yinjinlu
* @date 2024-10-31
*/
public interface WmsInPlanMapper
{
/**
* 查询入库计划
*
* @param planId 入库计划主键
* @return 入库计划
*/
public WmsInPlan selectWmsInPlanByPlanId(String planId);
/**
* 查询入库计划列表
*
* @param wmsInPlan 入库计划
* @return 入库计划集合
*/
public List<WmsInPlan> selectWmsInPlanList(WmsInPlan wmsInPlan);
/**
* 新增入库计划
*
* @param wmsInPlan 入库计划
* @return 结果
*/
public int insertWmsInPlan(WmsInPlan wmsInPlan);
/**
* 修改入库计划
*
* @param wmsInPlan 入库计划
* @return 结果
*/
public int updateWmsInPlan(WmsInPlan wmsInPlan);
/**
* 删除入库计划
*
* @param planId 入库计划主键
* @return 结果
*/
public int deleteWmsInPlanByPlanId(String planId);
/**
* 批量删除入库计划
*
* @param planIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteWmsInPlanByPlanIds(String[] planIds);
/**
* 批量删除入库计划明细
*
* @param planIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteWmsInPlanDetailsByPlanIds(String[] planIds);
/**
* 批量新增入库计划明细
*
* @param wmsInPlanDetailsList 入库计划明细列表
* @return 结果
*/
public int batchWmsInPlanDetails(List<WmsInPlanDetails> wmsInPlanDetailsList);
/**
* 通过入库计划主键删除入库计划明细信息
*
* @param planId 入库计划ID
* @return 结果
*/
public int deleteWmsInPlanDetailsByPlanId(String planId);
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlan;
/**
* 入库计划Service接口
*
* @author yinjinlu
* @date 2024-10-31
*/
public interface IWmsInPlanService
{
/**
* 查询入库计划
*
* @param planId 入库计划主键
* @return 入库计划
*/
public WmsInPlan selectWmsInPlanByPlanId(String planId);
/**
* 查询入库计划列表
*
* @param wmsInPlan 入库计划
* @return 入库计划集合
*/
public List<WmsInPlan> selectWmsInPlanList(WmsInPlan wmsInPlan);
/**
* 新增入库计划
*
* @param wmsInPlan 入库计划
* @return 结果
*/
public int insertWmsInPlan(WmsInPlan wmsInPlan);
/**
* 修改入库计划
*
* @param wmsInPlan 入库计划
* @return 结果
*/
public int updateWmsInPlan(WmsInPlan wmsInPlan);
/**
* 批量删除入库计划
*
* @param planIds 需要删除的入库计划主键集合
* @return 结果
*/
public int deleteWmsInPlanByPlanIds(String[] planIds);
/**
* 删除入库计划信息
*
* @param planId 入库计划主键
* @return 结果
*/
public int deleteWmsInPlanByPlanId(String planId);
}

View File

@ -0,0 +1,134 @@
package com.ktg.mes.wm.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ktg.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import com.ktg.mes.wm.mapper.WmsInPlanMapper;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.service.IWmsInPlanService;
/**
* 入库计划Service业务层处理
*
* @author yinjinlu
* @date 2024-10-31
*/
@Service
public class WmsInPlanServiceImpl implements IWmsInPlanService
{
@Autowired
private WmsInPlanMapper wmsInPlanMapper;
/**
* 查询入库计划
*
* @param planId 入库计划主键
* @return 入库计划
*/
@Override
public WmsInPlan selectWmsInPlanByPlanId(String planId)
{
return wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
}
/**
* 查询入库计划列表
*
* @param wmsInPlan 入库计划
* @return 入库计划
*/
@Override
public List<WmsInPlan> selectWmsInPlanList(WmsInPlan wmsInPlan)
{
return wmsInPlanMapper.selectWmsInPlanList(wmsInPlan);
}
/**
* 新增入库计划
*
* @param wmsInPlan 入库计划
* @return 结果
*/
@Transactional
@Override
public int insertWmsInPlan(WmsInPlan wmsInPlan)
{
wmsInPlan.setCreateTime(DateUtils.getNowDate());
int rows = wmsInPlanMapper.insertWmsInPlan(wmsInPlan);
insertWmsInPlanDetails(wmsInPlan);
return rows;
}
/**
* 修改入库计划
*
* @param wmsInPlan 入库计划
* @return 结果
*/
@Transactional
@Override
public int updateWmsInPlan(WmsInPlan wmsInPlan)
{
wmsInPlan.setUpdateTime(DateUtils.getNowDate());
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanId(wmsInPlan.getPlanId());
insertWmsInPlanDetails(wmsInPlan);
return wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
}
/**
* 批量删除入库计划
*
* @param planIds 需要删除的入库计划主键
* @return 结果
*/
@Transactional
@Override
public int deleteWmsInPlanByPlanIds(String[] planIds)
{
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanIds(planIds);
return wmsInPlanMapper.deleteWmsInPlanByPlanIds(planIds);
}
/**
* 删除入库计划信息
*
* @param planId 入库计划主键
* @return 结果
*/
@Transactional
@Override
public int deleteWmsInPlanByPlanId(String planId)
{
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanId(planId);
return wmsInPlanMapper.deleteWmsInPlanByPlanId(planId);
}
/**
* 新增入库计划明细信息
*
* @param wmsInPlan 入库计划对象
*/
public void insertWmsInPlanDetails(WmsInPlan wmsInPlan)
{
List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
String planId = wmsInPlan.getPlanId();
if (StringUtils.isNotNull(wmsInPlanDetailsList))
{
List<WmsInPlanDetails> list = new ArrayList<WmsInPlanDetails>();
for (WmsInPlanDetails wmsInPlanDetails : wmsInPlanDetailsList)
{
wmsInPlanDetails.setPlanId(planId);
list.add(wmsInPlanDetails);
}
if (list.size() > 0)
{
wmsInPlanMapper.batchWmsInPlanDetails(list);
}
}
}
}

View File

@ -63,7 +63,6 @@
IS_RECORD_INBOUND_TIME,
REMARK
from WMS_BUSINESS_TYPE
where IS_DELETE = 0
</sql>
<select id="selectWmsBusinessTypeList" parameterType="WmsBusinessType" resultMap="WmsBusinessTypeResult">
@ -74,7 +73,7 @@
<if test="updateBy != null and updateBy != ''">and UPDATE_BY = #{updateBy}</if>
<if test="modifyDate != null and modifyDate != ''">and MODIFY_DATE = #{modifyDate}</if>
<if test="isActive != null and isActive != ''">and IS_ACTIVE = #{isActive}</if>
<if test="isDelete != null and isDelete != ''">and IS_DELETE = #{isDelete}</if>
and IS_DELETE = 0
<if test="code != null and code != ''">and CODE = #{code}</if>
<if test="name != null and name != ''">and NAME like concat('%', #{name}, '%')</if>
<if test="flag != null and flag != ''">and FLAG = #{flag}</if>

View File

@ -0,0 +1,229 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.WmsInPlanMapper">
<resultMap type="WmsInPlan" id="WmsInPlanResult">
<result property="planId" column="PLAN_ID" />
<result property="state" column="STATE" />
<result property="sourceType" column="SOURCE_TYPE" />
<result property="wareId" column="WARE_ID" />
<result property="cellCode" column="CELL_CODE" />
<result property="workOrderCode" column="WORK_ORDER_CODE" />
<result property="expectDate" column="EXPECT_DATE" />
<result property="publishName" column="PUBLISH_NAME" />
<result property="publishTime" column="PUBLISH_TIME" />
<result property="closerId" column="CLOSER_ID" />
<result property="closeTime" column="CLOSE_TIME" />
<result property="relBillCode" column="REL_BILL_CODE" />
<result property="createBy" column="CREATE_BY" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateTime" column="UPDATE_TIME" />
<result property="updateBy" column="UPDATE_BY" />
<result property="remark" column="REMARK" />
<result property="customerId" column="CUSTOMER_ID" />
<result property="poCode" column="PO_CODE" />
<result property="departmentId" column="DEPARTMENT_ID" />
<result property="contractNo" column="CONTRACT_NO" />
<result property="supplierId" column="SUPPLIER_ID" />
<result property="businessTypeId" column="BUSINESS_TYPE_ID" />
<result property="srcOutTaskId" column="SRC_OUT_TASK_ID" />
<result property="isActive" column="IS_ACTIVE" />
<result property="isDelete" column="IS_DELETE" />
<result property="planCode" column="PLAN_CODE" />
<result property="planTypeId" column="PLAN_TYPE_ID" />
</resultMap>
<resultMap id="WmsInPlanWmsInPlanDetailsResult" type="WmsInPlan" extends="WmsInPlanResult">
<collection property="wmsInPlanDetailsList" notNullColumn="sub_DETAILS_ID" javaType="java.util.List" resultMap="WmsInPlanDetailsResult" />
</resultMap>
<resultMap type="WmsInPlanDetails" id="WmsInPlanDetailsResult">
<result property="detailsId" column="sub_DETAILS_ID" />
<result property="planId" column="sub_PLAN_ID" />
<result property="materialId" column="sub_MATERIAL_ID" />
<result property="batch" column="sub_BATCH" />
<result property="cellId" column="sub_CELL_ID" />
<result property="quantity" column="sub_QUANTITY" />
<result property="quantityIn" column="sub_QUANTITY_IN" />
<result property="planInStatus" column="sub_PLAN_IN_STATUS" />
<result property="remark" column="sub_REMARK" />
<result property="createBy" column="sub_CREATE_BY" />
<result property="createTime" column="sub_CREATE_TIME" />
<result property="updateBy" column="sub_UPDATE_BY" />
<result property="updateTime" column="sub_UPDATE_TIME" />
<result property="isActivy" column="sub_IS_ACTIVY" />
<result property="isDelete" column="sub_IS_DELETE" />
</resultMap>
<sql id="selectWmsInPlanVo">
select PLAN_ID, STATE, SOURCE_TYPE, WARE_ID, CELL_CODE, WORK_ORDER_CODE, EXPECT_DATE, PUBLISH_NAME, PUBLISH_TIME, CLOSER_ID, CLOSE_TIME, REL_BILL_CODE, CREATE_BY, CREATE_TIME, UPDATE_TIME, UPDATE_BY, REMARK, CUSTOMER_ID, PO_CODE, DEPARTMENT_ID, CONTRACT_NO, SUPPLIER_ID, BUSINESS_TYPE_ID, SRC_OUT_TASK_ID, IS_ACTIVE, IS_DELETE, PLAN_CODE, PLAN_TYPE_ID from WMS_IN_PLAN
</sql>
<select id="selectWmsInPlanList" parameterType="WmsInPlan" resultMap="WmsInPlanResult">
<include refid="selectWmsInPlanVo"/>
<where>
<if test="state != null and state != ''"> and STATE = #{state}</if>
<if test="sourceType != null and sourceType != ''"> and SOURCE_TYPE = #{sourceType}</if>
<if test="wareId != null and wareId != ''"> and WARE_ID = #{wareId}</if>
<if test="cellCode != null and cellCode != ''"> and CELL_CODE = #{cellCode}</if>
<if test="workOrderCode != null and workOrderCode != ''"> and WORK_ORDER_CODE = #{workOrderCode}</if>
<if test="expectDate != null and expectDate != ''"> and EXPECT_DATE = #{expectDate}</if>
<if test="publishName != null and publishName != ''"> and PUBLISH_NAME like concat('%', #{publishName}, '%')</if>
<if test="publishTime != null and publishTime != ''"> and PUBLISH_TIME = #{publishTime}</if>
<if test="closerId != null and closerId != ''"> and CLOSER_ID = #{closerId}</if>
<if test="closeTime != null and closeTime != ''"> and CLOSE_TIME = #{closeTime}</if>
<if test="relBillCode != null and relBillCode != ''"> and REL_BILL_CODE = #{relBillCode}</if>
<if test="createBy != null and createBy != ''"> and CREATE_BY = #{createBy}</if>
<if test="createTime != null and createTime != ''"> and CREATE_TIME = #{createTime}</if>
<if test="updateTime != null and updateTime != ''"> and UPDATE_TIME = #{updateTime}</if>
<if test="updateBy != null and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
<if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
<if test="customerId != null and customerId != ''"> and CUSTOMER_ID = #{customerId}</if>
<if test="poCode != null and poCode != ''"> and PO_CODE = #{poCode}</if>
<if test="departmentId != null and departmentId != ''"> and DEPARTMENT_ID = #{departmentId}</if>
<if test="contractNo != null and contractNo != ''"> and CONTRACT_NO = #{contractNo}</if>
<if test="supplierId != null and supplierId != ''"> and SUPPLIER_ID = #{supplierId}</if>
<if test="businessTypeId != null and businessTypeId != ''"> and BUSINESS_TYPE_ID = #{businessTypeId}</if>
<if test="srcOutTaskId != null and srcOutTaskId != ''"> and SRC_OUT_TASK_ID = #{srcOutTaskId}</if>
<if test="isActive != null and isActive != ''"> and IS_ACTIVE = #{isActive}</if>
<if test="isDelete != null and isDelete != ''"> and IS_DELETE = #{isDelete}</if>
<if test="planCode != null and planCode != ''"> and PLAN_CODE = #{planCode}</if>
<if test="planTypeId != null and planTypeId != ''"> and PLAN_TYPE_ID = #{planTypeId}</if>
</where>
</select>
<select id="selectWmsInPlanByPlanId" parameterType="String" resultMap="WmsInPlanWmsInPlanDetailsResult">
select a.PLAN_ID, a.STATE, a.SOURCE_TYPE, a.WARE_ID, a.CELL_CODE, a.WORK_ORDER_CODE, a.EXPECT_DATE, a.PUBLISH_NAME, a.PUBLISH_TIME, a.CLOSER_ID, a.CLOSE_TIME, a.REL_BILL_CODE, a.CREATE_BY, a.CREATE_TIME, a.UPDATE_TIME, a.UPDATE_BY, a.REMARK, a.CUSTOMER_ID, a.PO_CODE, a.DEPARTMENT_ID, a.CONTRACT_NO, a.SUPPLIER_ID, a.BUSINESS_TYPE_ID, a.SRC_OUT_TASK_ID, a.IS_ACTIVE, a.IS_DELETE, a.PLAN_CODE, a.PLAN_TYPE_ID,
b.DETAILS_ID as sub_DETAILS_ID, b.PLAN_ID as sub_PLAN_ID, b.MATERIAL_ID as sub_MATERIAL_ID, b.BATCH as sub_BATCH, b.CELL_ID as sub_CELL_ID, b.QUANTITY as sub_QUANTITY, b.QUANTITY_IN as sub_QUANTITY_IN, b.PLAN_IN_STATUS as sub_PLAN_IN_STATUS, b.REMARK as sub_REMARK, b.CREATE_BY as sub_CREATE_BY, b.CREATE_TIME as sub_CREATE_TIME, b.UPDATE_BY as sub_UPDATE_BY, b.UPDATE_TIME as sub_UPDATE_TIME, b.IS_ACTIVY as sub_IS_ACTIVY, b.IS_DELETE as sub_IS_DELETE
from WMS_IN_PLAN a
left join WMS_IN_PLAN_DETAILS b on b.PLAN_ID = a.PLAN_ID
where a.PLAN_ID = #{planId}
</select>
<insert id="insertWmsInPlan" parameterType="WmsInPlan" useGeneratedKeys="true" keyProperty="planId">
insert into WMS_IN_PLAN
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="state != null">STATE,</if>
<if test="sourceType != null">SOURCE_TYPE,</if>
<if test="wareId != null">WARE_ID,</if>
<if test="cellCode != null">CELL_CODE,</if>
<if test="workOrderCode != null">WORK_ORDER_CODE,</if>
<if test="expectDate != null">EXPECT_DATE,</if>
<if test="publishName != null">PUBLISH_NAME,</if>
<if test="publishTime != null">PUBLISH_TIME,</if>
<if test="closerId != null">CLOSER_ID,</if>
<if test="closeTime != null">CLOSE_TIME,</if>
<if test="relBillCode != null">REL_BILL_CODE,</if>
<if test="createBy != null">CREATE_BY,</if>
<if test="createTime != null">CREATE_TIME,</if>
<if test="updateTime != null">UPDATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if>
<if test="remark != null">REMARK,</if>
<if test="customerId != null">CUSTOMER_ID,</if>
<if test="poCode != null">PO_CODE,</if>
<if test="departmentId != null">DEPARTMENT_ID,</if>
<if test="contractNo != null">CONTRACT_NO,</if>
<if test="supplierId != null">SUPPLIER_ID,</if>
<if test="businessTypeId != null">BUSINESS_TYPE_ID,</if>
<if test="srcOutTaskId != null">SRC_OUT_TASK_ID,</if>
<if test="isActive != null">IS_ACTIVE,</if>
<if test="isDelete != null">IS_DELETE,</if>
<if test="planCode != null">PLAN_CODE,</if>
<if test="planTypeId != null">PLAN_TYPE_ID,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="state != null">#{state},</if>
<if test="sourceType != null">#{sourceType},</if>
<if test="wareId != null">#{wareId},</if>
<if test="cellCode != null">#{cellCode},</if>
<if test="workOrderCode != null">#{workOrderCode},</if>
<if test="expectDate != null">#{expectDate},</if>
<if test="publishName != null">#{publishName},</if>
<if test="publishTime != null">#{publishTime},</if>
<if test="closerId != null">#{closerId},</if>
<if test="closeTime != null">#{closeTime},</if>
<if test="relBillCode != null">#{relBillCode},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="remark != null">#{remark},</if>
<if test="customerId != null">#{customerId},</if>
<if test="poCode != null">#{poCode},</if>
<if test="departmentId != null">#{departmentId},</if>
<if test="contractNo != null">#{contractNo},</if>
<if test="supplierId != null">#{supplierId},</if>
<if test="businessTypeId != null">#{businessTypeId},</if>
<if test="srcOutTaskId != null">#{srcOutTaskId},</if>
<if test="isActive != null">#{isActive},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planTypeId != null">#{planTypeId},</if>
</trim>
</insert>
<update id="updateWmsInPlan" parameterType="WmsInPlan">
update WMS_IN_PLAN
<trim prefix="SET" suffixOverrides=",">
<if test="state != null">STATE = #{state},</if>
<if test="sourceType != null">SOURCE_TYPE = #{sourceType},</if>
<if test="wareId != null">WARE_ID = #{wareId},</if>
<if test="cellCode != null">CELL_CODE = #{cellCode},</if>
<if test="workOrderCode != null">WORK_ORDER_CODE = #{workOrderCode},</if>
<if test="expectDate != null">EXPECT_DATE = #{expectDate},</if>
<if test="publishName != null">PUBLISH_NAME = #{publishName},</if>
<if test="publishTime != null">PUBLISH_TIME = #{publishTime},</if>
<if test="closerId != null">CLOSER_ID = #{closerId},</if>
<if test="closeTime != null">CLOSE_TIME = #{closeTime},</if>
<if test="relBillCode != null">REL_BILL_CODE = #{relBillCode},</if>
<if test="createBy != null">CREATE_BY = #{createBy},</if>
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
<if test="remark != null">REMARK = #{remark},</if>
<if test="customerId != null">CUSTOMER_ID = #{customerId},</if>
<if test="poCode != null">PO_CODE = #{poCode},</if>
<if test="departmentId != null">DEPARTMENT_ID = #{departmentId},</if>
<if test="contractNo != null">CONTRACT_NO = #{contractNo},</if>
<if test="supplierId != null">SUPPLIER_ID = #{supplierId},</if>
<if test="businessTypeId != null">BUSINESS_TYPE_ID = #{businessTypeId},</if>
<if test="srcOutTaskId != null">SRC_OUT_TASK_ID = #{srcOutTaskId},</if>
<if test="isActive != null">IS_ACTIVE = #{isActive},</if>
<if test="isDelete != null">IS_DELETE = #{isDelete},</if>
<if test="planCode != null">PLAN_CODE = #{planCode},</if>
<if test="planTypeId != null">PLAN_TYPE_ID = #{planTypeId},</if>
</trim>
where PLAN_ID = #{planId}
</update>
<delete id="deleteWmsInPlanByPlanId" parameterType="String">
delete from WMS_IN_PLAN where PLAN_ID = #{planId}
</delete>
<delete id="deleteWmsInPlanByPlanIds" parameterType="String">
delete from WMS_IN_PLAN where PLAN_ID in
<foreach item="planId" collection="array" open="(" separator="," close=")">
#{planId}
</foreach>
</delete>
<delete id="deleteWmsInPlanDetailsByPlanIds" parameterType="String">
delete from WMS_IN_PLAN_DETAILS where PLAN_ID in
<foreach item="planId" collection="array" open="(" separator="," close=")">
#{planId}
</foreach>
</delete>
<delete id="deleteWmsInPlanDetailsByPlanId" parameterType="String">
delete from WMS_IN_PLAN_DETAILS where PLAN_ID = #{planId}
</delete>
<insert id="batchWmsInPlanDetails">
insert into WMS_IN_PLAN_DETAILS( PLAN_ID, MATERIAL_ID, BATCH, CELL_ID, QUANTITY, QUANTITY_IN, PLAN_IN_STATUS, REMARK, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, IS_ACTIVY, IS_DELETE) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.planId}, #{item.materialId}, #{item.batch}, #{item.cellId}, #{item.quantity}, #{item.quantityIn}, #{item.planInStatus}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.isActivy}, #{item.isDelete})
</foreach>
</insert>
</mapper>