@ -83,6 +83,9 @@ public class ProOrderServiceImpl implements IProOrderService {
// 生成对应工单表
// 一级
ProOrderWorkorder firWorkOrder = setWorkOrder ( proOrderWorkorder , product ) ;
// code
int endCode = getEndCode ( product . getId ( ) ) ;
firWorkOrder . setWorkorderCode ( product . getOrderCode ( ) + "-" + endCode ) ;
// 更新到数据库
proOrderWorkorderMapper . insertProOrderWorkorder ( firWorkOrder ) ;
// 创建通用批次表对象
@ -100,6 +103,8 @@ public class ProOrderServiceImpl implements IProOrderService {
// 设置父工单
proOrderWorkorder . setParentOrder ( firWorkOrder . getWorkorderCode ( ) ) ;
ProOrderWorkorder secWorkOrder = setWorkOrder ( proOrderWorkorder , product ) ;
// code
secWorkOrder . setWorkorderCode ( product . getOrderCode ( ) + "-" + ( endCode + 1 ) ) ;
// 更新到数据库
proOrderWorkorderMapper . insertProOrderWorkorder ( secWorkOrder ) ;
// 生成批次表并更新到数据库
@ -117,6 +122,8 @@ public class ProOrderServiceImpl implements IProOrderService {
ProOrderWorkorder thiWorkOrder = setWorkOrder ( proOrderWorkorder , product ) ;
// 设置为底层节点
thiWorkOrder . setIsEnd ( 1 ) ;
// code
thiWorkOrder . setWorkorderCode ( product . getOrderCode ( ) + "-" + ( endCode + 2 ) ) ;
// 更新到数据库
proOrderWorkorderMapper . insertProOrderWorkorder ( thiWorkOrder ) ;
// 生成批次表并更新到数据库
@ -226,8 +233,12 @@ public class ProOrderServiceImpl implements IProOrderService {
* /
@Override
@DS ( "#header.poolName" )
public LineAndShiftVo getProdLineShift ( ) {
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo ( proOrderMapper . selectProdLine ( ) , proOrderMapper . selectProShift ( ) ) ;
public LineAndShiftVo getProdLineShift ( String type ) {
if ( type . equals ( "white" ) ) {
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo ( proOrderMapper . selectProdLine ( ) , proOrderMapper . selectProShift ( ) ) ;
return lineAndShiftVo ;
}
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo ( proOrderMapper . selectPackageLine ( ) , proOrderMapper . selectProShift ( ) ) ;
return lineAndShiftVo ;
}
@ -251,9 +262,6 @@ public class ProOrderServiceImpl implements IProOrderService {
@Override
@DS ( "#header.poolName" )
public List < ProOrder > selectProOrderList ( ProOrder proOrder ) {
if ( proOrder . getStatus ( ) = = null | | proOrder . getStatus ( ) . equals ( " " ) ) {
proOrder . setStatus ( "1" ) ;
}
List < ProOrder > proOrderList = proOrderMapper . selectProOrderList ( proOrder ) ;
for ( int i = 0 ; i < proOrderList . size ( ) ; i + + ) {
proOrderList . get ( i ) . setStatus ( changeStatus ( proOrderList . get ( i ) . getStatus ( ) ) ) ;
@ -270,8 +278,17 @@ public class ProOrderServiceImpl implements IProOrderService {
@Override
@DS ( "#header.poolName" )
public int insertProOrder ( ProOrder proOrder ) {
// 获取当前时间
Date date = new Date ( ) ;
proOrder . setId ( IdUtils . fastSimpleUUID ( ) ) ;
proOrder . setCreateTime ( DateUtils . getNowDate ( ) ) ;
proOrder . setParentOrder ( "0" ) ;
proOrder . setStatus ( "o0" ) ;
proOrder . setOrderType ( proOrder . getProdType ( ) ) ;
proOrder . setOrderCode ( "DD" + DateUtils . parseDateToStr ( DateUtils . YYYYMMDDHHMMSSsss , date ) ) ;
proOrder . setCreateBy ( SecurityContextHolder . getUserName ( ) ) ;
proOrder . setCreateTime ( date ) ;
proOrder . setUpdateBy ( SecurityContextHolder . getUserName ( ) ) ;
proOrder . setUpdateTime ( date ) ;
return proOrderMapper . insertProOrder ( proOrder ) ;
}
@ -328,8 +345,8 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrderWorkorder . setProductDate ( date ) ;
// 产品(物料)编码
proOrderWorkorder . setProductCode ( proOrder . getProdCode ( ) ) ;
// TODO 产品(物料)名称
proOrderWorkorder . setProductName ( "测试ing" ) ;
// 产品(物料)名称
proOrderWorkorder . setProductName ( proOrder . getProdDesc ( ) ) ;
// 产品(物料)规格型号
proOrderWorkorder . setProductSpc ( proOrder . getProdSpc ( ) ) ;
// 产线
@ -337,8 +354,8 @@ public class ProOrderServiceImpl implements IProOrderService {
// 班次
proOrderWorkorder . setShiftId ( shiftId ) ;
// TODO 产品类型(pro_type)
// 单据状态(1为 正常 )
proOrderWorkorder . setStatus ( " 1 ") ;
// 单据状态(1为 已经下达0未下达 )
proOrderWorkorder . setStatus ( " w0 ") ;
return proOrderWorkorder ;
}
@ -355,15 +372,15 @@ public class ProOrderServiceImpl implements IProOrderService {
// 订单表更新时间/更新者
proOrder . setUpdateBy ( SecurityContextHolder . getUserName ( ) ) ;
proOrder . setUpdateTime ( date ) ;
// 设置订单状态
proOrder . setStatus ( "o1" ) ;
// 更新订单表
proOrderMapper . updateOrder ( proOrder ) ;
// 生成对应的工单表
// 生成id
proOrderWorkorder . setWorkorderId ( IdUtils . fastSimpleUUID ( ) ) ;
// 生成工单号
proOrderWorkorder . setWorkorderCode ( "GD" + DateUtils . parseDateToStr ( DateUtils . YYYYMMDDHHMMSSsss , date ) ) ;
// TODO 工单名称
proOrderWorkorder . setWorkorderName ( "测试ing" ) ;
proOrderWorkorder . setWorkorderCode ( proOrder . getOrderCode ( ) ) ;
// 订单id
proOrderWorkorder . setOrderId ( proOrder . getId ( ) ) ;
// 订单编码
@ -372,8 +389,6 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrderWorkorder . setUnit ( proOrder . getUnit ( ) ) ;
// 已拆分数量
proOrderWorkorder . setQuantitySplit ( Long . valueOf ( proOrder . getAtrr1 ( ) ) ) ;
// TODO 工艺编码
// TODO 所有父节点
return proOrderWorkorder ;
}
@ -384,7 +399,6 @@ public class ProOrderServiceImpl implements IProOrderService {
* /
private ProOrderWorkorderBatch setCommonBatchAttribute ( ) {
ProOrderWorkorderBatch workBatch = new ProOrderWorkorderBatch ( ) ;
Date date = new Date ( ) ;
// 更新者
workBatch . setUpdateBy ( SecurityContextHolder . getUserName ( ) ) ;
// 创建者
@ -404,7 +418,7 @@ public class ProOrderServiceImpl implements IProOrderService {
private void setBatch ( ProOrderWorkorderBatch workBatch , List < Batch > batchList , String workOrderId ) {
// 工单id
workBatch . setWorkorderId ( workOrderId ) ;
// TODO 产品类型
// 产品类型
for ( int i = 0 ; i < batchList . size ( ) ; i + + ) {
// 生成批次id
workBatch . setBatchId ( IdUtils . fastSimpleUUID ( ) ) ;
@ -425,12 +439,35 @@ public class ProOrderServiceImpl implements IProOrderService {
* @return
* /
private String changeStatus ( String status ) {
if ( status . equals ( " 0") ) {
if ( status . equals ( " o 0") ) {
return "未拆分" ;
}
if ( status . equals ( " 1") ) {
if ( status . equals ( " o 1") ) {
return "已拆分" ;
}
return status ;
}
/ * *
* 获 取 工 单 尾 号 code
* @param id
* @return
* /
private int getEndCode ( String id ) {
String workOrderCode = proOrderWorkorderMapper . selectEndWorkOrder ( id ) ;
if ( workOrderCode = = null | | workOrderCode . equals ( "" ) ) {
return 1 ;
}
int hyphenIndex = workOrderCode . indexOf ( '-' ) ; // 查找 '-' 的索引
if ( hyphenIndex ! = - 1 ) { // 如果找到了 '-' 字符
String substring = workOrderCode . substring ( hyphenIndex + 1 ) ; // 从 '-' 的下一位开始截取到字符串的末尾
// 将截取到的字符串转换为整数
int endCode = Integer . parseInt ( substring ) ;
return endCode + 1 ;
} else {
return 1 ;
}
}
}