Merge remote-tracking branch 'origin/master'

master
赵嘉伟 4 years ago
commit 9f41870344

@ -153,4 +153,13 @@ public interface Constants {
String ABNORMAL_MESSAGE_CORRECTION_CONFIRM = "CORRECTION_CONFIRM";//纠防确认
String ABNORMAL_MESSAGE_CANCEL = "CANCEL";//取消
/**
*
*/
// 原材料标签
String PRINT_TYPE_INV = "INV";
// 在制品标签
String PRINT_TYPE_SFC = "SFC";
}

@ -15,6 +15,8 @@ public class LabelPrintDto implements Serializable {
private String printer;
//打印模板名称
private String printTemplate;
//原材料标签参数
//物料编码
private String item;
//物料描述
@ -24,6 +26,7 @@ public class LabelPrintDto implements Serializable {
//批次号
private String batch;
//在制品标签参数
//工作指令
private String workOrder;
//图纸版本号

@ -6,11 +6,14 @@ import cn.hutool.json.JSONString;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.LabelPrintDto;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.foreverwin.mesnac.common.mapper.PrintLogMapper;
import com.foreverwin.mesnac.common.service.PrintLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
@ -39,6 +42,9 @@ public class PrintLogServiceImpl extends ServiceImpl<PrintLogMapper, PrintLog> i
@Autowired
private PrintLogMapper printLogMapper;
@Autowired
private PrintLogService printLogService;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void savePrintLog(String site, String user, PrintLog printLog) {
@ -54,10 +60,6 @@ public class PrintLogServiceImpl extends ServiceImpl<PrintLogMapper, PrintLog> i
@Override
public void labelPrint(String site, String user, List<PrintLog> printList) {
if (printList == null || printList.size() <= 0) {
return;
}
List<LabelPrintDto> labelPrintDtoList = new ArrayList<>();
for (PrintLog printLog : printList) {
LabelPrintDto labelPrintDto = new LabelPrintDto();
@ -67,7 +69,32 @@ public class PrintLogServiceImpl extends ServiceImpl<PrintLogMapper, PrintLog> i
labelPrintDto.setItemDescription(printLog.getItemDescription());
labelPrintDtoList.add(labelPrintDto);
}
String post = HttpUtil.post(printServer, JSON.toJSONString(labelPrintDtoList), 30000);
/**
* {"msg":"打印成功","code":0}
* {"msg":"打印失败","code":500}
* -printNameisPrint
*/
JSONObject jsonObject = JSONObject.parseObject(post);
String code = jsonObject.getString("code");
if (code == null){
}
List<PrintLog> printLogList = new ArrayList<>();
if (post.indexOf("500") != -1){
throw BusinessException.build("打印失败!");
}
for (PrintLog printLog : printList) {
PrintLog printLogOne = new PrintLog();
printLogOne.setHandle(printLog.getHandle());
printLogOne.setIsPrint("true");
// 更新日志
if (printLog.getCategory().equals(Constants.PRINT_TYPE_INV)){
printLogOne.setPrintName(printLog.getPrintName());
}
printLogList.add(printLogOne);
}
printLogService.updateBatchById(printLogList);
HttpUtil.post(printServer, JSON.toJSONString(labelPrintDtoList), 30000);
}
}
Loading…
Cancel
Save