WebService接口日志记录类

Leon 4 years ago
parent 5678977022
commit d52fd91f67

@ -15,4 +15,6 @@ public interface Constants {
String STATUS_Y = "Y";
String STATUS_N = "N";
String SITE_ADMIN = "SITE_ADMIN";
}

@ -3,4 +3,5 @@ package com.foreverwin.mesnac.common.constant;
public class IntegrationTypeConstant {
public static final String ITEM = "ITEM";
public static final String ITEM_BATCH_RECEIVE = "ITEM_BATCH_RECEIVE";
}

@ -1,153 +0,0 @@
package com.foreverwin.mesnac.common.dto;
import org.dom4j.Text;
import java.io.Serializable;
import java.util.Map;
public class WeChatDto implements Serializable {
public WeChatDto() {
this.msgtype = "text";
}
/**
* ID|1000
* @all
*/
private String touser;
/**
* ID|100
* touser@all
*/
private String toparty;
/**
* ID|100
* touser@all
*/
private String totag;
/**
*
* text
*/
private String msgtype;
/**
*
* id
*/
private int agentid;
/**
*
* 2048id
* A(\n)
*
* "text": {"content":"xxyy"}
*/
private Object text;
/**
* 010
*/
private String safe;
/**
* id010
*/
private String enable_id_trans;
/**
* 010
*/
private String enable_duplicate_check;
/**
* 1800s4
*/
private String duplicate_check_interval;
public String getTouser() {
return touser;
}
public void setTouser(String touser) {
this.touser = touser;
}
public String getToparty() {
return toparty;
}
public void setToparty(String toparty) {
this.toparty = toparty;
}
public String getTotag() {
return totag;
}
public void setTotag(String totag) {
this.totag = totag;
}
public String getMsgtype() {
return msgtype;
}
public void setMsgtype(String msgtype) {
this.msgtype = msgtype;
}
public int getAgentid() {
return agentid;
}
public void setAgentid(int agentid) {
this.agentid = agentid;
}
public Object getText() {
return text;
}
public void setText(Object text) {
this.text = text;
}
public String getSafe() {
return safe;
}
public void setSafe(String safe) {
this.safe = safe;
}
public String getEnable_id_trans() {
return enable_id_trans;
}
public void setEnable_id_trans(String enable_id_trans) {
this.enable_id_trans = enable_id_trans;
}
public String getEnable_duplicate_check() {
return enable_duplicate_check;
}
public void setEnable_duplicate_check(String enable_duplicate_check) {
this.enable_duplicate_check = enable_duplicate_check;
}
public String getDuplicate_check_interval() {
return duplicate_check_interval;
}
public void setDuplicate_check_interval(String duplicate_check_interval) {
this.duplicate_check_interval = duplicate_check_interval;
}
}

@ -71,6 +71,9 @@ public enum HandleEnum {
/**设备检验任务**/
RESOURCE_INSPECT_TASK("ResourceInspectTaskBo","ResourceInspectTaskBo:{0},{1}"),
/**物料批次**/
ITEM_BATCH("ItemBatchBo", "ItemBatchBo:{0},{1},{2}"),
/**设备检验任务的检验项**/
RESOURCE_INSPECT_TASK_PARAM("ResourceInspectTaskParamBo","ResourceInspectTaskParamBo:{0},{1}");

@ -1,139 +0,0 @@
package com.foreverwin.mesnac.common.util;
import cn.hutool.extra.mail.MailAccount;
import cn.hutool.extra.mail.MailUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import java.io.File;
import java.util.Collection;
/**
*
*
*
* @author Leon
* @since 2021-06-07
*/
@Component
@ConditionalOnProperty(prefix = "mail", name = {"host","from"})
public class SendMail {
@Value("${mail.host}")
private String host;
@Value("${mail.from}")
private String from;
/**
*
*
* @param to ","","
* @param subject
* @param content
* @param files
*/
public void sendText(String to, String subject, String content, File... files) {
MailUtil.send(getMailAccount(), to, subject, content, false, files);
}
/**
*
*
* @param tos
* @param subject
* @param content
* @param files
*/
public void sendText(Collection<String> tos, String subject, String content, File... files) {
MailUtil.send(getMailAccount(), tos, subject, content, false, files);
}
/**
*
*
* @param tos
* @param ccs
* @param subject
* @param content
* @param files
*/
public void sendText(Collection<String> tos, Collection<String> ccs, String subject, String content, File... files) {
MailUtil.send(getMailAccount(), tos, ccs, null, subject, content, false, files);
}
/**
*
*
* @param tos
* @param ccs
* @param bccs
* @param subject
* @param content
* @param files
*/
public void sendText(Collection<String> tos, Collection<String> ccs, Collection<String> bccs, String subject, String content, File... files) {
MailUtil.send(getMailAccount(), tos, ccs, bccs, subject, content, false, files);
}
/**
* HTML
*
* @param to ","","
* @param subject
* @param content
* @param files
*/
public void sendHtml(String to, String subject, String content, File... files) {
MailUtil.send(getMailAccount(), to, subject, content, true, files);
}
/**
* HTML
*
* @param tos
* @param subject
* @param content
* @param files
*/
public void sendHtml(Collection<String> tos, String subject, String content, File... files) {
MailUtil.send(getMailAccount(), tos, subject, content, true, files);
}
/**
* HTML
*
* @param tos
* @param ccs
* @param subject
* @param content
* @param files
*/
public void sendHtml(Collection<String> tos, Collection<String> ccs,String subject, String content, File... files) {
MailUtil.send(getMailAccount(), tos, ccs, null, subject, content, true, files);
}
/**
* HTML
*
* @param tos
* @param ccs
* @param bccs
* @param subject
* @param content
* @param files
*/
public void sendHtml(Collection<String> tos, Collection<String> ccs, Collection<String> bccs, String subject, String content, File... files) {
MailUtil.send(getMailAccount(), tos, ccs, bccs, subject, content, true, files);
}
private MailAccount getMailAccount() {
MailAccount mailAccount = new MailAccount();
mailAccount.setHost(host);
mailAccount.setFrom(from);
return mailAccount;
}
}

@ -1,69 +0,0 @@
package com.foreverwin.mesnac.common.util;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.dto.WeChatDto;
import com.foreverwin.modular.core.exception.BusinessException;
import org.dom4j.Text;
import org.jsoup.Connection.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
*
*
*
* @author Leon
* @since 2021-06-07
*/
@Component
@ConditionalOnProperty(prefix = "wechat", name = {"agentId","postUrl"})
public class SendWeChat {
@Value("${wechat.agentId}")
private int agentId;
@Value("${wechat.postUrl}")
private String postUrl;
@Autowired
private TokenSingleton tokenSingleton;
public void sendMessage(String toUser, String content) {
try {
Map<String, String> map = tokenSingleton.getMap();
String accessToken = map.get("access_token");
//短信内容参数
WeChatDto weChatDto = new WeChatDto();
weChatDto.setTouser(toUser);
weChatDto.setAgentid(agentId);
Map<String, Object> text = new HashMap<>();
text.put("content", content);
weChatDto.setText(text);
postUrl = postUrl.replace("ACCESS_TOKEN", accessToken);
Response response = HttpUtils.post(postUrl, JSONObject.toJSONString(weChatDto));
if (null != response) {
String body = response.body();
JSONObject jsonObject = (JSONObject) JSONObject.parse(body);
int errCode = jsonObject.getInteger("errcode");
if (errCode != 0) {
throw BusinessException.build(jsonObject.getString("errmsg"));
}
if (errCode == 44004) {
}
}
} catch (Exception e) {
}
}
}

@ -0,0 +1,127 @@
package com.foreverwin.mesnac.dispatch.controller;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.dispatch.service.ItemBatchService;
import com.foreverwin.mesnac.dispatch.model.ItemBatch;
import java.util.List;
/**
*
* @author Leon.L
* @since 2021-06-18
*/
@RestController
@RequestMapping("/Z-ITEM-BATCH")
public class ItemBatchController {
@Autowired
public ItemBatchService itemBatchService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getItemBatchById(@PathVariable String id) {
return R.ok( itemBatchService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getItemBatchList(ItemBatch itemBatch){
List<ItemBatch> result;
QueryWrapper<ItemBatch> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(itemBatch);
result = itemBatchService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<ItemBatch> frontPage, ItemBatch itemBatch){
IPage result;
QueryWrapper<ItemBatch> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(itemBatch);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(ItemBatch::getHandle, frontPage.getGlobalQuery())
.or().like(ItemBatch::getSite, frontPage.getGlobalQuery())
.or().like(ItemBatch::getFactory, frontPage.getGlobalQuery())
.or().like(ItemBatch::getItem, frontPage.getGlobalQuery())
.or().like(ItemBatch::getBatch, frontPage.getGlobalQuery())
.or().like(ItemBatch::getSupplier, frontPage.getGlobalQuery())
.or().like(ItemBatch::getLabel, frontPage.getGlobalQuery())
.or().like(ItemBatch::getIsPrint, frontPage.getGlobalQuery())
.or().like(ItemBatch::getCreateUser, frontPage.getGlobalQuery())
.or().like(ItemBatch::getModifyUser, frontPage.getGlobalQuery())
);
}
result = itemBatchService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param itemBatch
* @return null
*/
@PostMapping
public R save(@RequestBody ItemBatch itemBatch) {
return R.ok(itemBatchService.save(itemBatch));
}
/**
*
* @param itemBatch
* @return null
*/
@PutMapping
public R updateById(@RequestBody ItemBatch itemBatch) {
return R.ok(itemBatchService.updateById(itemBatch));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(itemBatchService.removeById(id));
}
/**
*
* @param ids ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/delete-batch")
public R removeByIds(List<String> ids){
return R.ok(itemBatchService.removeByIds(ids));
}
}

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.dispatch.model.UserResource;
import com.foreverwin.mesnac.dispatch.service.UserResourceService;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
@ -133,4 +134,17 @@ public class UserResourceController {
userResourceService.saveAll(map);
return R.ok();
}
@ResponseBody
@GetMapping("/findEmployeeList")
public R findEmployeeList(String resource) {
try {
String site = CommonMethods.getSite();
return R.ok(userResourceService.findEmployeeList(site, resource));
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
}

@ -0,0 +1,18 @@
package com.foreverwin.mesnac.dispatch.mapper;
import com.foreverwin.mesnac.dispatch.model.ItemBatch;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author Leon.L
* @since 2021-06-18
*/
@Repository
public interface ItemBatchMapper extends BaseMapper<ItemBatch> {
}

@ -2,6 +2,7 @@ package com.foreverwin.mesnac.dispatch.mapper;
import com.foreverwin.mesnac.dispatch.model.UserResource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -18,6 +19,7 @@ import java.util.List;
@Repository
public interface UserResourceMapper extends BaseMapper<UserResource> {
List<UserResource> findEnableList(@Param("site") String site, @Param("resource") String resource, @Param("user") String user);
List<NwaUser> findEmployeeList(@Param("site") String site, @Param("resource") String resource);
List<UserResource> findEnableList(@Param("site") String site, @Param("resource") String resource, @Param("user") String user);
}

@ -0,0 +1,229 @@
package com.foreverwin.mesnac.dispatch.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
/**
* <p>
*
* </p>
*
* @author Leon.L
* @since 2021-06-18
*/
@TableName("Z_ITEM_BATCH")
public class ItemBatch extends Model<ItemBatch> {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
/**
*
*/
@TableField("SITE")
private String site;
/**
*
*/
@TableField("FACTORY")
private String factory;
/**
*
*/
@TableField("ITEM")
private String item;
/**
*
*/
@TableField("BATCH")
private String batch;
/**
*
*/
@TableField("SUPPLIER")
private String supplier;
/**
*
*/
@TableField("LABEL")
private String label;
@TableField("IS_PRINT")
private String isPrint;
/**
*
*/
@TableField("CREATE_USER")
private String createUser;
/**
*
*/
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
/**
*
*/
@TableField("MODIFY_USER")
private String modifyUser;
/**
*
*/
@TableField("MODIFIED_DATE_TIME")
private LocalDateTime modifiedDateTime;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getFactory() {
return factory;
}
public void setFactory(String factory) {
this.factory = factory;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public String getBatch() {
return batch;
}
public void setBatch(String batch) {
this.batch = batch;
}
public String getSupplier() {
return supplier;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getIsPrint() {
return isPrint;
}
public void setIsPrint(String isPrint) {
this.isPrint = isPrint;
}
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public LocalDateTime getCreatedDateTime() {
return createdDateTime;
}
public void setCreatedDateTime(LocalDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
}
public String getModifyUser() {
return modifyUser;
}
public void setModifyUser(String modifyUser) {
this.modifyUser = modifyUser;
}
public LocalDateTime getModifiedDateTime() {
return modifiedDateTime;
}
public void setModifiedDateTime(LocalDateTime modifiedDateTime) {
this.modifiedDateTime = modifiedDateTime;
}
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String FACTORY = "FACTORY";
public static final String ITEM = "ITEM";
public static final String BATCH = "BATCH";
public static final String SUPPLIER = "SUPPLIER";
public static final String LABEL = "LABEL";
public static final String IS_PRINT = "IS_PRINT";
public static final String CREATE_USER = "CREATE_USER";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String MODIFY_USER = "MODIFY_USER";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "ItemBatch{" +
"handle = " + handle +
", site = " + site +
", factory = " + factory +
", item = " + item +
", batch = " + batch +
", supplier = " + supplier +
", label = " + label +
", isPrint = " + isPrint +
", createUser = " + createUser +
", createdDateTime = " + createdDateTime +
", modifyUser = " + modifyUser +
", modifiedDateTime = " + modifiedDateTime +
"}";
}
}

@ -9,217 +9,219 @@ import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.foreverwin.mesnac.common.model.ExcelColumn;
/**
* <p>
*
*
* </p>
*
* @author Leon.L
* @since 2021-06-09
* @since 2021-06-21
*/
@TableName("Z_SFC_DISPATCH")
public class SfcDispatch extends Model<SfcDispatch> {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
*
*/
/**
*
*/
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
/**
*
*/
/**
*
*/
@TableField("SITE")
private String site;
/**
*
*/
/**
*
*/
@TableField("SHOP_ORDER")
private String shopOrder;
/**
* SFC
*/
/**
*
*/
@TableField("SFC")
@ExcelColumn("SFC")
private String sfc;
/**
*
*/
/**
*
*/
@TableField("BLANKING_SIZE")
private String blankingSize;
/**
*
*/
/**
*
*/
@TableField("DISPATCH_SEQ")
private String dispatchSeq;
/**
*
*/
/**
*
*/
@TableField("DISPATCH_NO")
private String dispatchNo;
/**
* /NEW/RELEASE/PAUSE/CANCEL/COMPLETE
*/
/**
*
*/
@TableField("DISPATCH_STATUS")
private String dispatchStatus;
/**
*
*/
/**
*
*/
@TableField("DRAWINGS_NO")
private String drawingsNo;
/**
*
*/
/**
*
*/
@TableField("DRAWINGS_REVISION")
private String drawingsRevision;
/**
*
*/
/**
*
*/
@TableField("IS_LOCK")
private String isLock;
/**
* 线
*/
/**
* 线
*/
@TableField("ROUTER_BO")
private String routerBo;
/**
*
*/
/**
*
*/
@TableField("STEP_ID")
private String stepId;
/**
*
*/
/**
*
*/
@TableField("OPERATION")
private String operation;
/**
*
*/
/**
*
*/
@TableField("RESOURCE_TYPE")
private String resourceType;
/**
*
*/
/**
*
*/
@TableField("WORK_CENTER")
private String workCenter;
/**
*
*/
/**
*
*/
@TableField("RESRCE")
private String resrce;
/**
*
*/
/**
*
*/
@TableField("EMPLOYEE")
private String employee;
/**
*
*/
/**
*
*/
@TableField("TURN_OPERATION")
private String turnOperation;
/**
*
*/
/**
*
*/
@TableField("DISPATCH_QTY")
private Double dispatchQty;
/**
*
*/
/**
*
*/
@TableField("PROD_HOURS")
private Double prodHours;
/**
*
*/
/**
*
*/
@TableField("PLANNED_START_DATE")
private LocalDateTime plannedStartDate;
/**
*
*/
/**
*
*/
@TableField("PLANNED_COMP_DATE")
private LocalDateTime plannedCompDate;
/**
*
*/
/**
*
*/
@TableField("EARLIEST_START_DATE")
private LocalDateTime earliestStartDate;
/**
*
*/
/**
*
*/
@TableField("LATEST_END_DATE")
private LocalDateTime latestEndDate;
/**
*
*/
/**
*
*/
@TableField("SO_RELEASED_DATE")
private LocalDateTime soReleasedDate;
/**
* SFC
*/
/**
*
*/
@TableField("SFC_RELEASED_DATE")
private LocalDateTime sfcReleasedDate;
/**
*
*/
/**
*
*/
@TableField("RELEASED_COMPLETE_DATE")
private LocalDateTime releasedCompleteDate;
/**
*
*/
/**
*
*/
@TableField("ACTUAL_START_DATE")
private LocalDateTime actualStartDate;
/**
*
*/
/**
*
*/
@TableField("ACTUAL_COMPLETE_DATE")
private LocalDateTime actualCompleteDate;
/**
*
*/
/**
*
*/
@TableField("IS_DISPATCH")
private String isDispatch;
/**
*
*/
/**
*
*/
@TableField("IS_IMPORT")
private String isImport;
/**
*
*/
/**
*
*/
@TableField("REMARK")
private String remark;
/**
*
*/
/**
*
*/
@TableField("PREPOSITION_OPERATION")
private String prepositionOperation;
/**
*
*/
@TableField("IS_FIRST_OPERATION")
private String isFirstOperation;
/**
*
*/
/**
*
*/
@TableField("CREATE_USER")
private String createUser;
/**
*
*/
/**
*
*/
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
/**
*
*/
/**
*
*/
@TableField("MODIFY_USER")
private String modifyUser;
/**
*
*/
/**
*
*/
@TableField("MODIFIED_DATE_TIME")
private LocalDateTime modifiedDateTime;
/**
*
*/
/**
*
*/
@TableField("OTHER_1")
private String other1;
@TableField("OTHER_2")
@ -496,6 +498,14 @@ public class SfcDispatch extends Model<SfcDispatch> {
this.remark = remark;
}
public String getPrepositionOperation() {
return prepositionOperation;
}
public void setPrepositionOperation(String prepositionOperation) {
this.prepositionOperation = prepositionOperation;
}
public String getIsFirstOperation() {
return isFirstOperation;
}
@ -576,91 +586,93 @@ public class SfcDispatch extends Model<SfcDispatch> {
this.other5 = other5;
}
public static final String HANDLE = "HANDLE";
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String SITE = "SITE";
public static final String SHOP_ORDER = "SHOP_ORDER";
public static final String SHOP_ORDER = "SHOP_ORDER";
public static final String SFC = "SFC";
public static final String SFC = "SFC";
public static final String BLANKING_SIZE = "BLANKING_SIZE";
public static final String BLANKING_SIZE = "BLANKING_SIZE";
public static final String DISPATCH_SEQ = "DISPATCH_SEQ";
public static final String DISPATCH_SEQ = "DISPATCH_SEQ";
public static final String DISPATCH_NO = "DISPATCH_NO";
public static final String DISPATCH_NO = "DISPATCH_NO";
public static final String DISPATCH_STATUS = "DISPATCH_STATUS";
public static final String DISPATCH_STATUS = "DISPATCH_STATUS";
public static final String DRAWINGS_NO = "DRAWINGS_NO";
public static final String DRAWINGS_NO = "DRAWINGS_NO";
public static final String DRAWINGS_REVISION = "DRAWINGS_REVISION";
public static final String DRAWINGS_REVISION = "DRAWINGS_REVISION";
public static final String IS_LOCK = "IS_LOCK";
public static final String IS_LOCK = "IS_LOCK";
public static final String ROUTER_BO = "ROUTER_BO";
public static final String ROUTER_BO = "ROUTER_BO";
public static final String STEP_ID = "STEP_ID";
public static final String STEP_ID = "STEP_ID";
public static final String OPERATION = "OPERATION";
public static final String OPERATION = "OPERATION";
public static final String RESOURCE_TYPE = "RESOURCE_TYPE";
public static final String RESOURCE_TYPE = "RESOURCE_TYPE";
public static final String WORK_CENTER = "WORK_CENTER";
public static final String WORK_CENTER = "WORK_CENTER";
public static final String RESRCE = "RESRCE";
public static final String RESRCE = "RESRCE";
public static final String EMPLOYEE = "EMPLOYEE";
public static final String EMPLOYEE = "EMPLOYEE";
public static final String TURN_OPERATION = "TURN_OPERATION";
public static final String TURN_OPERATION = "TURN_OPERATION";
public static final String DISPATCH_QTY = "DISPATCH_QTY";
public static final String DISPATCH_QTY = "DISPATCH_QTY";
public static final String PROD_HOURS = "PROD_HOURS";
public static final String PROD_HOURS = "PROD_HOURS";
public static final String PLANNED_START_DATE = "PLANNED_START_DATE";
public static final String PLANNED_START_DATE = "PLANNED_START_DATE";
public static final String PLANNED_COMP_DATE = "PLANNED_COMP_DATE";
public static final String PLANNED_COMP_DATE = "PLANNED_COMP_DATE";
public static final String EARLIEST_START_DATE = "EARLIEST_START_DATE";
public static final String EARLIEST_START_DATE = "EARLIEST_START_DATE";
public static final String LATEST_END_DATE = "LATEST_END_DATE";
public static final String LATEST_END_DATE = "LATEST_END_DATE";
public static final String SO_RELEASED_DATE = "SO_RELEASED_DATE";
public static final String SO_RELEASED_DATE = "SO_RELEASED_DATE";
public static final String SFC_RELEASED_DATE = "SFC_RELEASED_DATE";
public static final String SFC_RELEASED_DATE = "SFC_RELEASED_DATE";
public static final String RELEASED_COMPLETE_DATE = "RELEASED_COMPLETE_DATE";
public static final String RELEASED_COMPLETE_DATE = "RELEASED_COMPLETE_DATE";
public static final String ACTUAL_START_DATE = "ACTUAL_START_DATE";
public static final String ACTUAL_START_DATE = "ACTUAL_START_DATE";
public static final String ACTUAL_COMPLETE_DATE = "ACTUAL_COMPLETE_DATE";
public static final String ACTUAL_COMPLETE_DATE = "ACTUAL_COMPLETE_DATE";
public static final String IS_DISPATCH = "IS_DISPATCH";
public static final String IS_DISPATCH = "IS_DISPATCH";
public static final String IS_IMPORT = "IS_IMPORT";
public static final String IS_IMPORT = "IS_IMPORT";
public static final String REMARK = "REMARK";
public static final String REMARK = "REMARK";
public static final String PREPOSITION_OPERATION = "PREPOSITION_OPERATION";
public static final String IS_FIRST_OPERATION = "IS_FIRST_OPERATION";
public static final String IS_FIRST_OPERATION = "IS_FIRST_OPERATION";
public static final String CREATE_USER = "CREATE_USER";
public static final String CREATE_USER = "CREATE_USER";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String MODIFY_USER = "MODIFY_USER";
public static final String MODIFY_USER = "MODIFY_USER";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
public static final String OTHER_1 = "OTHER_1";
public static final String OTHER_1 = "OTHER_1";
public static final String OTHER_2 = "OTHER_2";
public static final String OTHER_2 = "OTHER_2";
public static final String OTHER_3 = "OTHER_3";
public static final String OTHER_3 = "OTHER_3";
public static final String OTHER_4 = "OTHER_4";
public static final String OTHER_4 = "OTHER_4";
public static final String OTHER_5 = "OTHER_5";
public static final String OTHER_5 = "OTHER_5";
@Override
@ -671,49 +683,50 @@ public class SfcDispatch extends Model<SfcDispatch> {
@Override
public String toString() {
return "SfcDispatch{" +
"handle = " + handle +
", site = " + site +
", shopOrder = " + shopOrder +
", sfc = " + sfc +
", blankingSize = " + blankingSize +
", dispatchSeq = " + dispatchSeq +
", dispatchNo = " + dispatchNo +
", dispatchStatus = " + dispatchStatus +
", drawingsNo = " + drawingsNo +
", drawingsRevision = " + drawingsRevision +
", isLock = " + isLock +
", routerBo = " + routerBo +
", stepId = " + stepId +
", operation = " + operation +
", resourceType = " + resourceType +
", workCenter = " + workCenter +
", resrce = " + resrce +
", employee = " + employee +
", turnOperation = " + turnOperation +
", dispatchQty = " + dispatchQty +
", prodHours = " + prodHours +
", plannedStartDate = " + plannedStartDate +
", plannedCompDate = " + plannedCompDate +
", earliestStartDate = " + earliestStartDate +
", latestEndDate = " + latestEndDate +
", soReleasedDate = " + soReleasedDate +
", sfcReleasedDate = " + sfcReleasedDate +
", releasedCompleteDate = " + releasedCompleteDate +
", actualStartDate = " + actualStartDate +
", actualCompleteDate = " + actualCompleteDate +
", isDispatch = " + isDispatch +
", isImport = " + isImport +
", remark = " + remark +
", isFirstOperation = " + isFirstOperation +
", createUser = " + createUser +
", createdDateTime = " + createdDateTime +
", modifyUser = " + modifyUser +
", modifiedDateTime = " + modifiedDateTime +
", other1 = " + other1 +
", other2 = " + other2 +
", other3 = " + other3 +
", other4 = " + other4 +
", other5 = " + other5 +
"}";
"handle = " + handle +
", site = " + site +
", shopOrder = " + shopOrder +
", sfc = " + sfc +
", blankingSize = " + blankingSize +
", dispatchSeq = " + dispatchSeq +
", dispatchNo = " + dispatchNo +
", dispatchStatus = " + dispatchStatus +
", drawingsNo = " + drawingsNo +
", drawingsRevision = " + drawingsRevision +
", isLock = " + isLock +
", routerBo = " + routerBo +
", stepId = " + stepId +
", operation = " + operation +
", resourceType = " + resourceType +
", workCenter = " + workCenter +
", resrce = " + resrce +
", employee = " + employee +
", turnOperation = " + turnOperation +
", dispatchQty = " + dispatchQty +
", prodHours = " + prodHours +
", plannedStartDate = " + plannedStartDate +
", plannedCompDate = " + plannedCompDate +
", earliestStartDate = " + earliestStartDate +
", latestEndDate = " + latestEndDate +
", soReleasedDate = " + soReleasedDate +
", sfcReleasedDate = " + sfcReleasedDate +
", releasedCompleteDate = " + releasedCompleteDate +
", actualStartDate = " + actualStartDate +
", actualCompleteDate = " + actualCompleteDate +
", isDispatch = " + isDispatch +
", isImport = " + isImport +
", remark = " + remark +
", prepositionOperation = " + prepositionOperation +
", isFirstOperation = " + isFirstOperation +
", createUser = " + createUser +
", createdDateTime = " + createdDateTime +
", modifyUser = " + modifyUser +
", modifiedDateTime = " + modifiedDateTime +
", other1 = " + other1 +
", other2 = " + other2 +
", other3 = " + other3 +
", other4 = " + other4 +
", other5 = " + other5 +
"}";
}
}

@ -59,6 +59,7 @@ public class ShopOrderRelease extends SfcDispatch {
private String operationDescription;
private String isCompleted;
private BigDecimal completedQty;
private String userName;
private LocalDateTime dispatchCompleteDate;
@ -215,6 +216,14 @@ public class ShopOrderRelease extends SfcDispatch {
this.completedQty = completedQty;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public LocalDateTime getDispatchCompleteDate() {
return dispatchCompleteDate;
}

@ -0,0 +1,28 @@
package com.foreverwin.mesnac.dispatch.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.dispatch.model.ItemBatch;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Leon.L
* @since 2021-06-18
*/
public interface ItemBatchService extends IService<ItemBatch> {
/**
*
* @param frontPage
* @return
*/
IPage<ItemBatch> selectPage(FrontPage<ItemBatch> frontPage, ItemBatch itemBatch);
List<ItemBatch> selectList(ItemBatch itemBatch);
}

@ -2,6 +2,7 @@ package com.foreverwin.mesnac.dispatch.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.dispatch.model.UserResource;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import java.util.HashMap;
import java.util.List;
@ -16,6 +17,8 @@ import java.util.List;
*/
public interface UserResourceService extends IService<UserResource> {
List<NwaUser> findEmployeeList(String site, String resource);
List<UserResource> findEnableList(String site, String resource, String user);
List<UserResource> findAll(String resource,String user);

@ -0,0 +1,46 @@
package com.foreverwin.mesnac.dispatch.service.impl;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.dispatch.model.ItemBatch;
import com.foreverwin.mesnac.dispatch.mapper.ItemBatchMapper;
import com.foreverwin.mesnac.dispatch.service.ItemBatchService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Leon.L
* @since 2021-06-18
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class ItemBatchServiceImpl extends ServiceImpl<ItemBatchMapper, ItemBatch> implements ItemBatchService {
@Autowired
private ItemBatchMapper itemBatchMapper;
@Override
public IPage<ItemBatch> selectPage(FrontPage<ItemBatch> frontPage, ItemBatch itemBatch) {
QueryWrapper<ItemBatch> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(itemBatch);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<ItemBatch> selectList(ItemBatch itemBatch) {
QueryWrapper<ItemBatch> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(itemBatch);
return super.list(queryWrapper);
}
}

@ -247,8 +247,22 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
String dispatchNo = shopOrderRelease.getDispatchNo();
String resourceType = shopOrderRelease.getResourceType();
//派工保存
if (DispatchStatusEnum.SAVE.getCode().equals(type)) {
//校验派工状态
String originalStatus = shopOrderRelease.getDispatchStatus();
if (!DispatchStatusEnum.NEW.getCode().equals(originalStatus)) {
flag = false;
message.append(seq++ % 3 == 0 ? "\n" : "| |");
message.append("派工单[" + dispatchNo + "]的派工状态不是新建,不允许保存");
continue;
}
}
//派工导入
if (DispatchStatusEnum.IMPORT.getCode().equals(type)) {
//TODO 派工单已经开始或完成的不修改
String handle = HandleEnum.SFC_DISPATCH.getHandle(site, dispatchNo);
SfcDispatch sfcDispatchModel = this.getById(handle);
if (sfcDispatchModel == null) {
@ -263,11 +277,10 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
if (StringUtils.isBlank(resource) || shopOrderRelease.getPlannedStartDate() == null || shopOrderRelease.getPlannedCompDate() == null) {
flag = false;
message.append(seq++%3 == 0 ? "\n" : "| |");
message.append("派工单[" + dispatchNo + "]的资源、计划开始时间计划完成时间没维护,不允许发布");
message.append("派工单[" + dispatchNo + "]的资源、计划开始或完成时间没维护,不允许发布");
continue;
}
sfcDispatch.setHandle(handle);
//是否导入
sfcDispatch.setIsImport(Constants.BOOL_TRUE);
@ -288,7 +301,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
if (StringUtils.isBlank(resource) || shopOrderRelease.getPlannedStartDate() == null || shopOrderRelease.getPlannedCompDate() == null) {
flag = false;
message.append(seq++%3 == 0 ? "\n" : "| |");
message.append("派工单[" + dispatchNo + "]的资源、计划开始时间计划完成时间没维护,不允许发布");
message.append("派工单[" + dispatchNo + "]的资源、计划开始或完成时间没维护,不允许发布");
continue;
}
@ -318,7 +331,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
//校验操作者与资源是否匹配
String employee = shopOrderRelease.getEmployee();
String employee = shopOrderRelease.getUserName();
if (StringUtil.notBlank(employee)) {
//资源、计划时间必输
if (StringUtils.isBlank(resource)) {

@ -5,6 +5,7 @@ import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.dispatch.mapper.UserResourceMapper;
import com.foreverwin.mesnac.dispatch.model.UserResource;
import com.foreverwin.mesnac.dispatch.service.UserResourceService;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import com.foreverwin.modular.core.util.CommonMethods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -32,6 +33,10 @@ public class UserResourceServiceImpl extends ServiceImpl<UserResourceMapper, Use
private UserResourceMapper userResourceMapper;
@Override
public List<NwaUser> findEmployeeList(String site, String resource) {
return userResourceMapper.findEmployeeList(site, resource);
}
@Override
public List<UserResource> findEnableList(String site, String resource, String user) {

@ -0,0 +1,434 @@
<?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.foreverwin.mesnac.dispatch.mapper.ItemBatchMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.dispatch.model.ItemBatch">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="FACTORY" property="factory" />
<result column="ITEM" property="item" />
<result column="BATCH" property="batch" />
<result column="SUPPLIER" property="supplier" />
<result column="LABEL" property="label" />
<result column="IS_PRINT" property="isPrint" />
<result column="CREATE_USER" property="createUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="MODIFY_USER" property="modifyUser" />
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, FACTORY, ITEM, BATCH, SUPPLIER, LABEL, IS_PRINT, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_ITEM_BATCH WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_ITEM_BATCH
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectBatchIds" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_ITEM_BATCH WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_ITEM_BATCH
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
<if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
<if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_ITEM_BATCH
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
<if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
<if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_ITEM_BATCH
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
<if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
<if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMaps" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_ITEM_BATCH
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
<if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
<if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectObjs" resultType="Object">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_ITEM_BATCH
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
<if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
<if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectPage" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_ITEM_BATCH
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
<if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
<if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMapsPage" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_ITEM_BATCH
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
<if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
<if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.dispatch.model.ItemBatch">
INSERT INTO Z_ITEM_BATCH
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="factory!=null">FACTORY,</if>
<if test="item!=null">ITEM,</if>
<if test="batch!=null">BATCH,</if>
<if test="supplier!=null">SUPPLIER,</if>
<if test="label!=null">LABEL,</if>
<if test="isPrint!=null">IS_PRINT,</if>
<if test="createUser!=null">CREATE_USER,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="modifyUser!=null">MODIFY_USER,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="factory!=null">#{factory},</if>
<if test="item!=null">#{item},</if>
<if test="batch!=null">#{batch},</if>
<if test="supplier!=null">#{supplier},</if>
<if test="label!=null">#{label},</if>
<if test="isPrint!=null">#{isPrint},</if>
<if test="createUser!=null">#{createUser},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="modifyUser!=null">#{modifyUser},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.dispatch.model.ItemBatch">
INSERT INTO Z_ITEM_BATCH
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{factory},
#{item},
#{batch},
#{supplier},
#{label},
#{isPrint},
#{createUser},
#{createdDateTime},
#{modifyUser},
#{modifiedDateTime},
</trim>
</insert>
<update id="updateById">
UPDATE Z_ITEM_BATCH <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.factory!=null">FACTORY=#{et.factory},</if>
<if test="et.item!=null">ITEM=#{et.item},</if>
<if test="et.batch!=null">BATCH=#{et.batch},</if>
<if test="et.supplier!=null">SUPPLIER=#{et.supplier},</if>
<if test="et.label!=null">LABEL=#{et.label},</if>
<if test="et.isPrint!=null">IS_PRINT=#{et.isPrint},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifyUser!=null">MODIFY_USER=#{et.modifyUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="updateAllColumnById">
UPDATE Z_ITEM_BATCH <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
FACTORY=#{et.factory},
ITEM=#{et.item},
BATCH=#{et.batch},
SUPPLIER=#{et.supplier},
LABEL=#{et.label},
IS_PRINT=#{et.isPrint},
CREATE_USER=#{et.createUser},
CREATED_DATE_TIME=#{et.createdDateTime},
MODIFY_USER=#{et.modifyUser},
MODIFIED_DATE_TIME=#{et.modifiedDateTime},
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="update">
UPDATE Z_ITEM_BATCH <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.factory!=null">FACTORY=#{et.factory},</if>
<if test="et.item!=null">ITEM=#{et.item},</if>
<if test="et.batch!=null">BATCH=#{et.batch},</if>
<if test="et.supplier!=null">SUPPLIER=#{et.supplier},</if>
<if test="et.label!=null">LABEL=#{et.label},</if>
<if test="et.isPrint!=null">IS_PRINT=#{et.isPrint},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifyUser!=null">MODIFY_USER=#{et.modifyUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
<if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
<if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteById">
DELETE FROM Z_ITEM_BATCH WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_ITEM_BATCH
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM Z_ITEM_BATCH
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
<if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
<if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<delete id="deleteBatchIds">
DELETE FROM Z_ITEM_BATCH WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>

@ -37,6 +37,7 @@
<result column="IS_DISPATCH" property="isDispatch" />
<result column="IS_IMPORT" property="isImport" />
<result column="REMARK" property="remark" />
<result column="PREPOSITION_OPERATION" property="prepositionOperation" />
<result column="IS_FIRST_OPERATION" property="isFirstOperation" />
<result column="CREATE_USER" property="createUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
@ -59,6 +60,7 @@
<result column="ITEM_DESCRIPTION" property="itemDescription" />
<result column="COMPONENT" property="component" />
<result column="COMPLETED_QTY" property="completedQty" />
<result column="USER_NAME" property="userName" />
<result column="COMPONENT_DESCRIPTION" property="componentDescription" />
<result column="OPERATION_DESCRIPTION" property="operationDescription" />
</resultMap>
@ -66,7 +68,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, SHOP_ORDER, SFC, BLANKING_SIZE, DISPATCH_SEQ, DISPATCH_NO, DISPATCH_STATUS, DRAWINGS_NO, DRAWINGS_REVISION, IS_LOCK, ROUTER_BO, STEP_ID, OPERATION, RESOURCE_TYPE, WORK_CENTER, RESRCE, EMPLOYEE, TURN_OPERATION, DISPATCH_QTY, PROD_HOURS, PLANNED_START_DATE, PLANNED_COMP_DATE, EARLIEST_START_DATE, LATEST_END_DATE, SO_RELEASED_DATE, SFC_RELEASED_DATE, RELEASED_COMPLETE_DATE, ACTUAL_START_DATE, ACTUAL_COMPLETE_DATE, IS_DISPATCH, IS_IMPORT, REMARK, IS_FIRST_OPERATION, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME, OTHER_1, OTHER_2, OTHER_3, OTHER_4, OTHER_5
HANDLE, SITE, SHOP_ORDER, SFC, BLANKING_SIZE, DISPATCH_SEQ, DISPATCH_NO, DISPATCH_STATUS, DRAWINGS_NO, DRAWINGS_REVISION, IS_LOCK, ROUTER_BO, STEP_ID, OPERATION, RESOURCE_TYPE, WORK_CENTER, RESRCE, EMPLOYEE, TURN_OPERATION, DISPATCH_QTY, PROD_HOURS, PLANNED_START_DATE, PLANNED_COMP_DATE, EARLIEST_START_DATE, LATEST_END_DATE, SO_RELEASED_DATE, SFC_RELEASED_DATE, RELEASED_COMPLETE_DATE, ACTUAL_START_DATE, ACTUAL_COMPLETE_DATE, IS_DISPATCH, IS_IMPORT, REMARK, PREPOSITION_OPERATION, IS_FIRST_OPERATION, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME, OTHER_1, OTHER_2, OTHER_3, OTHER_4, OTHER_5
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
@ -548,6 +550,7 @@
<if test="isDispatch!=null">IS_DISPATCH,</if>
<if test="isImport!=null">IS_IMPORT,</if>
<if test="remark!=null">REMARK,</if>
<if test="prepositionOperation!=null">PREPOSITION_OPERATION,</if>
<if test="isFirstOperation!=null">IS_FIRST_OPERATION,</if>
<if test="createUser!=null">CREATE_USER,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
@ -593,6 +596,7 @@
<if test="isDispatch!=null">#{isDispatch},</if>
<if test="isImport!=null">#{isImport},</if>
<if test="remark!=null">#{remark},</if>
<if test="prepositionOperation!=null">#{prepositionOperation},</if>
<if test="isFirstOperation!=null">#{isFirstOperation},</if>
<if test="createUser!=null">#{createUser},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
@ -645,6 +649,7 @@
#{isDispatch},
#{isImport},
#{remark},
#{prepositionOperation},
#{isFirstOperation},
#{createUser},
#{createdDateTime},
@ -693,6 +698,7 @@
<if test="et.isDispatch!=null">IS_DISPATCH=#{et.isDispatch},</if>
<if test="et.isImport!=null">IS_IMPORT=#{et.isImport},</if>
<if test="et.remark!=null">REMARK=#{et.remark},</if>
<if test="et.prepositionOperation!=null">PREPOSITION_OPERATION=#{et.prepositionOperation},</if>
<if test="et.isFirstOperation!=null">IS_FIRST_OPERATION=#{et.isFirstOperation},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
@ -741,6 +747,7 @@
IS_DISPATCH=#{et.isDispatch},
IS_IMPORT=#{et.isImport},
REMARK=#{et.remark},
PREPOSITION_OPERATION=#{et.prepositionOperation},
IS_FIRST_OPERATION=#{et.isFirstOperation},
CREATE_USER=#{et.createUser},
CREATED_DATE_TIME=#{et.createdDateTime},
@ -789,6 +796,7 @@
<if test="et.isDispatch!=null">IS_DISPATCH=#{et.isDispatch},</if>
<if test="et.isImport!=null">IS_IMPORT=#{et.isImport},</if>
<if test="et.remark!=null">REMARK=#{et.remark},</if>
<if test="et.prepositionOperation!=null">PREPOSITION_OPERATION=#{et.prepositionOperation},</if>
<if test="et.isFirstOperation!=null">IS_FIRST_OPERATION=#{et.isFirstOperation},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
@ -836,6 +844,7 @@
<if test="ew.entity.isDispatch!=null"> AND IS_DISPATCH=#{ew.entity.isDispatch}</if>
<if test="ew.entity.isImport!=null"> AND IS_IMPORT=#{ew.entity.isImport}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.prepositionOperation!=null"> AND PREPOSITION_OPERATION=#{ew.entity.prepositionOperation}</if>
<if test="ew.entity.isFirstOperation!=null"> AND IS_FIRST_OPERATION=#{ew.entity.isFirstOperation}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -962,7 +971,7 @@
CASE WHEN WIP.DISPATCH_SEQ = 1 OR V1.OTHER_1 = 'true' THEN N'是' ELSE N'否' END IS_COMPLETED
FROM (
SELECT DISTINCT SD.HANDLE, SD.SITE, SD.SHOP_ORDER, SD.DISPATCH_NO, C1.VALUE WORK_ORDER, IM.ITEM, IT.DESCRIPTION ITEM_DESCRIPTION, SD.SFC, SD.DISPATCH_STATUS,
SD.STEP_ID, SD.OPERATION, OT.DESCRIPTION OPERATION_DESCRIPTION, SD.RESOURCE_TYPE, SD.RESRCE, SD.EMPLOYEE, SD.DISPATCH_QTY, SD.PROD_HOURS,
SD.STEP_ID, SD.OPERATION, OT.DESCRIPTION OPERATION_DESCRIPTION, SD.RESOURCE_TYPE, SD.RESRCE, SD.EMPLOYEE, SD.EMPLOYEE USER_NAME, SD.DISPATCH_QTY, SD.PROD_HOURS,
CASE WHEN OTHER_1 = 'true' THEN SD.DISPATCH_QTY ELSE 0 END COMPLETED_QTY, SD.PLANNED_START_DATE, SD.PLANNED_COMP_DATE, SD.WORK_CENTER, SD.IS_DISPATCH,
SD.ACTUAL_START_DATE, SD.ACTUAL_COMPLETE_DATE, SD.REMARK, SD.DISPATCH_SEQ, SD.DISPATCH_SEQ-1 BEFORE_SEQ, SD.DISPATCH_SEQ+1 AFTER_SEQ,
CASE WHEN SD.TURN_OPERATION = 'true' THEN N'是' ELSE N'否' END TURN_OPERATION, SD.BLANKING_SIZE,
@ -1015,16 +1024,16 @@
AND SD.IS_DISPATCH = #{isDispatch}
</if>
<if test="startFromDate != null">
AND SD.PLANNED_START_DATE >= #{startFromDate}
AND SO.PLANNED_START_DATE >= #{startFromDate}
</if>
<if test="startToDate != null">
AND SD.PLANNED_START_DATE &lt;= #{startToDate}
AND SO.PLANNED_START_DATE &lt;= #{startToDate}
</if>
<if test="completeFromDate != null">
AND SD.PLANNED_COMP_DATE >= #{completeFromDate}
AND SO.PLANNED_COMP_DATE >= #{completeFromDate}
</if>
<if test="completeToDate != null">
AND SD.PLANNED_COMP_DATE &lt;= #{completeToDate}
AND SO.PLANNED_COMP_DATE &lt;= #{completeToDate}
</if>
) WIP
LEFT JOIN Z_SFC_DISPATCH V1 ON V1.SITE = WIP.SITE AND V1.SFC = WIP.SFC AND V1.DISPATCH_SEQ = WIP.BEFORE_SEQ

@ -428,4 +428,10 @@
</if>
</select>
<select id="findEmployeeList" resultType="com.foreverwin.mesnac.meapi.model.NwaUser">
SELECT A.SITE, A.USER_ID USER_NAME, B.FIRST_NAME, B.LAST_NAME, B.FULL_NAME
FROM Z_USER_RESOURCE A
LEFT JOIN Z_NWA_USER B ON A.SITE = B.SITE AND A.USER_ID = B.USER_NAME
WHERE A.SITE = #{site} AND A.RESRCE = #{resource}
</select>
</mapper>

@ -30,6 +30,11 @@
<artifactId>modular-melib</artifactId>
</dependency>
<dependency>
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>meapi</artifactId>
</dependency>
<dependency>
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>common</artifactId>
@ -37,7 +42,7 @@
<dependency>
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>meapi</artifactId>
<artifactId>dispatch</artifactId>
</dependency>
</dependencies>
</project>

@ -1,9 +1,7 @@
package com.foreverwin.mesnac.integration.controller;
import com.foreverwin.mesnac.integration.service.IntegrationLogService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**

@ -1,10 +1,5 @@
package com.foreverwin.mesnac.integration.controller;
import com.foreverwin.mesnac.common.util.SendMail;
import com.foreverwin.mesnac.common.util.SendWeChat;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -13,20 +8,4 @@ import org.springframework.web.bind.annotation.RestController;
public class TestController {
@Autowired
private SendMail sendMail;
@Autowired
private SendWeChat sendWeChat;
@GetMapping("/sendMail")
public R test(String to, String subject, String content) {
sendMail.sendText(to, subject, content);
return R.ok(content);
}
@GetMapping("/sendWeChat")
public R sendWeChat(String toUser, String content) {
sendWeChat.sendMessage(toUser, content);
return R.ok(content);
}
}

@ -15,4 +15,8 @@ public interface ERPWebService {
*/
@WebMethod
String createItem(String data);
@WebMethod
String itemBatchReceive(String data);
}

@ -8,6 +8,15 @@ public interface InterfaceService {
*
*
* @param jsonObject
* @throws Exception
*/
void createOrUpdateItem(JSONObject jsonObject) throws Exception;
/**
*
*
* @param jsonObject
* @throws Exception
*/
void saveItemBatch(JSONObject jsonObject) ;
}

@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Service
@WebService(serviceName = "ERPWebService",
@ -59,22 +60,25 @@ public class ERPWebServiceImpl implements ERPWebService {
String site = null;
String handle = null;
LocalDateTime dateTime = null;
String dateTime = null;
JSONObject jsonObject = null;
WebServiceDto webServiceDto = WebServiceDto.success("物料保存/更新成功");
try {
jsonObject = JSON.parseObject(data);
site = jsonObject.getString("SITE");
handle = jsonObject.getString("TRANID");
String dateTimeStr = jsonObject.getString("DATE_TIME");
if (StringUtil.isBlank(dateTimeStr)) {
dateTime = jsonObject.getString("DATE_TIME");
if (StringUtil.isBlank(site)) {
throw BusinessException.build("站点参数不能为空");
}
if (StringUtil.isBlank(dateTime)) {
throw BusinessException.build("传送时间不能为空");
}
interfaceService.createOrUpdateItem(jsonObject);
} catch (Exception e) {
webServiceDto = WebServiceDto.fail(handle, e.getMessage());
return webServiceDto.toString();
return JSONObject.toJSONString(webServiceDto);
}
//记录接口日志
@ -88,10 +92,85 @@ public class ERPWebServiceImpl implements ERPWebService {
integrationLog.setParam(jsonObject.toJSONString());
integrationLog.setStatus(webServiceDto.getSTATUS());
integrationLog.setResultMessage(webServiceDto.getMESSAGE());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
integrationLog.setRequestDateTime(LocalDateTime.parse(dateTime, formatter));
integrationLog.setTransactionId(handle);
integrationLog.setCreatedDateTime(LocalDateTime.now());
integrationLogService.saveIntegrationLog(integrationLog);
//接口返回
return JSONObject.toJSONString(webServiceDto);
}
/**
* {
* "TRANID": "2021052616434400028",
* "DATE_TIME": "2021-06-16 15:31:00",
* "SITE": "1000",
* "FACTORY": "",
* "PURCHASE_ORDER": "", //采购订单
* "PURCHASE_ORDER_LIST": [{
* "SEQ": "", //行号
* "ITEM": "", //物料
* "DESCRIPTION": "",
* "SPECIFICATION": "",
* "SURFACES": "",
* "BATCH": "", //批次【供应商代码+接收日期(年月日)】
* "SUPPLIER": ""
* }]
* }
*
* @param data
* @return
*/
@Override
public String itemBatchReceive(@WebParam(name = "data") String data) {
logger.info("接收ERP传递物料批次接收参数:" + data);
String site = null;
String handle = null;
String dateTime = null;
JSONObject jsonObject = null;
WebServiceDto webServiceDto = WebServiceDto.success("物料批次接收成功");
try {
jsonObject = JSON.parseObject(data);
site = jsonObject.getString("SITE");
handle = jsonObject.getString("TRANID");
dateTime = jsonObject.getString("DATE_TIME");
if (StringUtil.isBlank(site)) {
throw BusinessException.build("站点参数不能为空");
}
if (StringUtil.isBlank(dateTime)) {
throw BusinessException.build("传送时间不能为空");
}
interfaceService.saveItemBatch(jsonObject);
} catch (Exception e) {
webServiceDto = WebServiceDto.fail(handle, e.getMessage());
return JSONObject.toJSONString(webServiceDto);
}
//记录接口日志
IntegrationLog integrationLog = new IntegrationLog();
integrationLog.setHandle(handle);
integrationLog.setSite(site);
integrationLog.setIntegrationType(IntegrationTypeConstant.ITEM_BATCH_RECEIVE);
integrationLog.setCategory("REQUEST");
integrationLog.setIntegrationWay("ERP");
integrationLog.setIntegrationMethod("saveItemBatch");
integrationLog.setParam(jsonObject.toJSONString());
integrationLog.setStatus(webServiceDto.getSTATUS());
integrationLog.setResultMessage(webServiceDto.getMESSAGE());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
integrationLog.setRequestDateTime(LocalDateTime.parse(dateTime, formatter));
integrationLog.setTransactionId(handle);
integrationLog.setCreatedDateTime(LocalDateTime.now());
integrationLogService.saveIntegrationLog(integrationLog);
return webServiceDto.toString();
//接口返回
return JSONObject.toJSONString(webServiceDto);
}
}

@ -1,11 +1,16 @@
package com.foreverwin.mesnac.integration.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dispatch.model.ItemBatch;
import com.foreverwin.mesnac.dispatch.service.ItemBatchService;
import com.foreverwin.mesnac.integration.service.InterfaceService;
import com.foreverwin.mesnac.meapi.model.Item;
import com.foreverwin.mesnac.meapi.service.ItemService;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.meext.MEServices;
import com.sap.me.common.CustomValue;
import com.sap.me.common.MaterialType;
@ -18,6 +23,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
/**
@ -34,6 +40,8 @@ public class InterfaceServiceImpl implements InterfaceService {
@Autowired
private ItemService itemService;
@Autowired
private ItemBatchService itemBatchService;
@Override
@ -124,4 +132,51 @@ public class InterfaceServiceImpl implements InterfaceService {
itemServiceInterFace.updateItem(updateItem);
}
}
@Override
public void saveItemBatch(JSONObject jsonObject) {
String site = jsonObject.getString("SITE");
String factory = jsonObject.getString("FACTORY");
JSONArray jsonArray = jsonObject.getJSONArray("PURCHASE_ORDER_LIST");
if (jsonArray == null || jsonArray.size() <= 0) {
throw BusinessException.build("接口参数【PURCHASE_ORDER_LIST】不能为空");
}
LocalDateTime now = LocalDateTime.now();
//循环处理 物料批次
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject _jsonObject = jsonArray.getJSONObject(i);
String item = _jsonObject.getString("ITEM");
String batch = _jsonObject.getString("BATCH");
String supplier = _jsonObject.getString("SUPPLIER");
//查询物料和批次是否已经存在记录
ItemBatch queryBatch = new ItemBatch();
queryBatch.setBatch(site);
queryBatch.setItem(item);
queryBatch.setBatch(batch);
List<ItemBatch> itemBatchList = itemBatchService.selectList(queryBatch);
if (itemBatchList != null && itemBatchList.size() > 0) {
//更新时间
ItemBatch itemBatch = itemBatchList.get(0);
itemBatch.setModifyUser(Constants.SITE_ADMIN);
itemBatch.setModifiedDateTime(now);
itemBatchService.updateById(itemBatch);
} else {
//新增物料批次数据
ItemBatch itemBatch = new ItemBatch();
itemBatch.setHandle(HandleEnum.ITEM_BATCH.getHandle(site, item, batch));
itemBatch.setSite(site);
itemBatch.setFactory(factory);
itemBatch.setItem(item);
itemBatch.setBatch(batch);
itemBatch.setSupplier(supplier);
itemBatch.setLabel(item + "*" + batch);
itemBatch.setIsPrint("false");
itemBatch.setCreateUser(Constants.SITE_ADMIN);
itemBatch.setCreatedDateTime(now);
itemBatchService.save(itemBatch);
}
}
}
}

@ -16,8 +16,9 @@ import java.time.LocalDateTime;
import java.util.UUID;
@Service
public class NwaPrincipaListener implements PrincipalListener {
private final Logger logger = LoggerFactory.getLogger(NwaPrincipaListener.class);
public class NwaPrincipalListener implements PrincipalListener {
private final Logger logger = LoggerFactory.getLogger(NwaPrincipalListener.class);
@Autowired
SysUserService sysUserService;

@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
@Service
public class NwaUserListener implements UserListener {
private final Logger logger = LoggerFactory.getLogger(NwaUserListener.class);
@Autowired

@ -18,14 +18,15 @@ import java.util.UUID;
@Component
public class StartListener implements ApplicationListener<ApplicationReadyEvent> {
private final Logger logger = LoggerFactory.getLogger(StartListener.class);
@Autowired
NwaUserListener nwaUserListener;
SysUserService sysUserService;
@Autowired
NwaPrincipaListener nwaPrincipaListener;
NwaUserListener nwaUserListener;
@Autowired
SysUserService sysUserService;
NwaPrincipalListener nwaPrincipalListener;
@Override
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
@ -36,11 +37,11 @@ public class StartListener implements ApplicationListener<ApplicationReadyEvent>
userFactory.registerListener(nwaUserListener, UserListener.INFORM_ON_USER_ADDED);// 注册新增用户监听
userFactory.registerListener(nwaUserListener, UserListener.INFORM_ON_USER_REMOVED);// 注册删除用户监听
//---------------------------------------------------------------------------------------------------------------------------
principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_ADDED);
principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_ASSIGNED);
principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_EDITED);
principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_REMOVED);
principalFactory.registerListener(nwaPrincipaListener, NwaPrincipaListener.INFORM_ON_OBJECT_UNASSIGNED);
principalFactory.registerListener(nwaPrincipalListener, NwaPrincipalListener.INFORM_ON_OBJECT_ADDED);
principalFactory.registerListener(nwaPrincipalListener, NwaPrincipalListener.INFORM_ON_OBJECT_ASSIGNED);
principalFactory.registerListener(nwaPrincipalListener, NwaPrincipalListener.INFORM_ON_OBJECT_EDITED);
principalFactory.registerListener(nwaPrincipalListener, NwaPrincipalListener.INFORM_ON_OBJECT_REMOVED);
principalFactory.registerListener(nwaPrincipalListener, NwaPrincipalListener.INFORM_ON_OBJECT_UNASSIGNED);
//---------------------------------------------------------------------------------------------------------------------------
initUser();
} catch (Exception e) {

@ -1,40 +0,0 @@
package com.foreverwin.mesnac.listener.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.foreverwin.mesnac.listener.model.UserSchedule;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper
* </p>
*
* @author xqy
* @since 2020-11-09
*/
@Repository
public interface UserScheduleMapper extends BaseMapper<UserSchedule> {
/**
* -
*
* @param site
* @param wcBo
* @param user
* @return
*/
List<UserSchedule> getInfoByUserOrWc(@Param("site") String site, @Param("wcBo") String wcBo, @Param("user") String user, @Param("scheduleStDt") String scheduleStDt, @Param("scheduleEdDt") String scheduleEdDt);
/**
* -MES-187RULE_01
*
* @param activityBo
* @return
*/
UserSchedule getActivityRule(@Param("activityBo") String activityBo);
List<UserSchedule>getShiftMappingGyAndMe(@Param("site") String site);
}

@ -1,377 +0,0 @@
package com.foreverwin.mesnac.listener.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.foreverwin.modular.core.util.I18nUtil;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author xqy
* @since 2020-11-09
*/
@TableName("Z_USER_SCHEDULE")
public class UserSchedule extends Model<UserSchedule> {
private static final long serialVersionUID = 1L;
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
@TableField("SITE")
private String site;
@TableField("USER_NAME")
private String userName;
@TableField("SCHEDULE_DATE")
private String scheduleDate;
@TableField("TYPE")
private String type;
@TableField("SCHEDULE_START_TIME")
private String scheduleStartTime;
@TableField("SCHEDULE_END_TIME")
private String scheduleEndTime;
@TableField("REMARK")
private String remark;
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
@TableField("UPDATED_DATE_TIME")
private LocalDateTime updatedDateTime;
@TableField("CREATE_USER_BO")
private String createUserBo;
@TableField("UPDATE_USER_BO")
private String updateUserBo;
/**
*
*/
@TableField("WEEK")
private String week;
/**
*
*/
@TableField("SHIFT")
private String shift;
// 班课ID
@TableField(exist = false)
private String wc;
// 班课描述
@TableField(exist = false)
private String wcName;
// 用户名称
@TableField(exist = false)
private String userFullName;
// 作业规则值
@TableField(exist = false)
private String activityValue;
// 班次描述
@TableField(exist = false)
private String shiftDesc;
//盖亚班次
@TableField(exist = false)
private String gyShift;
public String getGyShift() {
return gyShift;
}
public UserSchedule setGyShift(String gyShift) {
this.gyShift = gyShift;
return this;
}
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getScheduleDate() {
return scheduleDate;
}
public void setScheduleDate(String scheduleDate) {
this.scheduleDate = scheduleDate;
}
public String getType() {
return type;
}
public void setType(String type) {
if (I18nUtil.getI18nText("userSchedule.typeA").equals(type)) {
type = "A";
} else if (I18nUtil.getI18nText("userSchedule.typeB").equals(type)) {
type = "B";
} else if (I18nUtil.getI18nText("userSchedule.typeC").equals(type)) {
type = "C";
} else if (I18nUtil.getI18nText("userSchedule.typeD").equals(type)) {
type = "D";
} else if (I18nUtil.getI18nText("userSchedule.typeE").equals(type)) {
type = "E";
} else if (I18nUtil.getI18nText("userSchedule.typeF").equals(type)) {
type = "F";
} else if (I18nUtil.getI18nText("userSchedule.typeG").equals(type)) {
type = "G";
} else {
switch (type){
case "A":
type = I18nUtil.getI18nText("userSchedule.typeA");
break;
case "B":
type = I18nUtil.getI18nText("userSchedule.typeB");
break;
case "C":
type = I18nUtil.getI18nText("userSchedule.typeC");
break;
case "D":
type = I18nUtil.getI18nText("userSchedule.typeD");
break;
case "E":
type = I18nUtil.getI18nText("userSchedule.typeE");
break;
case "F":
type = I18nUtil.getI18nText("userSchedule.typeF");
break;
case "G":
type = I18nUtil.getI18nText("userSchedule.typeG");
break;
default :
type = type;
}
}
this.type = type;
}
public String getScheduleStartTime() {
return scheduleStartTime;
}
public void setScheduleStartTime(String scheduleStartTime) {
this.scheduleStartTime = scheduleStartTime;
}
public String getScheduleEndTime() {
return scheduleEndTime;
}
public void setScheduleEndTime(String scheduleEndTime) {
this.scheduleEndTime = scheduleEndTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public LocalDateTime getCreatedDateTime() {
return createdDateTime;
}
public void setCreatedDateTime(LocalDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
}
public LocalDateTime getUpdatedDateTime() {
return updatedDateTime;
}
public void setUpdatedDateTime(LocalDateTime updatedDateTime) {
this.updatedDateTime = updatedDateTime;
}
public String getCreateUserBo() {
return createUserBo;
}
public void setCreateUserBo(String createUserBo) {
this.createUserBo = createUserBo;
}
public String getUpdateUserBo() {
return updateUserBo;
}
public void setUpdateUserBo(String updateUserBo) {
this.updateUserBo = updateUserBo;
}
public String getWc() {
return wc;
}
public void setWc(String wc) {
this.wc = wc;
}
public String getWcName() {
return wcName;
}
public void setWcName(String wcName) {
this.wcName = wcName;
}
public String getUserFullName() {
return userFullName;
}
public void setUserFullName(String userFullName) {
this.userFullName = userFullName;
}
public String getActivityValue() {
return activityValue;
}
public void setActivityValue(String activityValue) {
this.activityValue = activityValue;
}
public String getWeek() {
return week;
}
public void setWeek(String week) {
if (I18nUtil.getI18nText("userSchedule.week1").equals(week)) {
week = "1";
} else if (I18nUtil.getI18nText("userSchedule.week2").equals(week)) {
week = "2";
} else if (I18nUtil.getI18nText("userSchedule.week3").equals(week)) {
week = "3";
} else if (I18nUtil.getI18nText("userSchedule.week4").equals(week)) {
week = "4";
} else if (I18nUtil.getI18nText("userSchedule.week5").equals(week)) {
week = "5";
} else if (I18nUtil.getI18nText("userSchedule.week6").equals(week)) {
week = "6";
} else if (I18nUtil.getI18nText("userSchedule.week7").equals(week)) {
week = "7";
} else {
switch (week){
case "1":
week = I18nUtil.getI18nText("userSchedule.week1");
break;
case "2":
week = I18nUtil.getI18nText("userSchedule.week2");
break;
case "3":
week = I18nUtil.getI18nText("userSchedule.week3");
break;
case "4":
week = I18nUtil.getI18nText("userSchedule.week4");
break;
case "5":
week = I18nUtil.getI18nText("userSchedule.week5");
break;
case "6":
week = I18nUtil.getI18nText("userSchedule.week6");
break;
case "7":
week = I18nUtil.getI18nText("userSchedule.week7");
break;
default :
week = week;
}
}
this.week = week;
}
public String getShift() {
return shift;
}
public void setShift(String shift) {
this.shift = shift;
}
public String getShiftDesc() {
return shiftDesc;
}
public void setShiftDesc(String shiftDesc) {
this.shiftDesc = shiftDesc;
}
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String USER_NAME = "USER_NAME";
public static final String SCHEDULE_DATE = "SCHEDULE_DATE";
public static final String TYPE = "TYPE";
public static final String SCHEDULE_START_TIME = "SCHEDULE_START_TIME";
public static final String SCHEDULE_END_TIME = "SCHEDULE_END_TIME";
public static final String REMARK = "REMARK";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String UPDATED_DATE_TIME = "UPDATED_DATE_TIME";
public static final String CREATE_USER_BO = "CREATE_USER_BO";
public static final String UPDATE_USER_BO = "UPDATE_USER_BO";
public static final String WEEK = "WEEK";
public static final String SHIFT = "SHIFT";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "UserSchedule{" +
"handle = " + handle +
", site = " + site +
", userName = " + userName +
", scheduleDate = " + scheduleDate +
", type = " + type +
", scheduleStartTime = " + scheduleStartTime +
", scheduleEndTime = " + scheduleEndTime +
", remark = " + remark +
", createdDateTime = " + createdDateTime +
", updatedDateTime = " + updatedDateTime +
", createUserBo = " + createUserBo +
", updateUserBo = " + updateUserBo +
", week = " + week +
", shift = " + shift +
"}";
}
}

@ -19,7 +19,6 @@ import java.time.LocalDateTime;
*/
@TableName("USR")
public class Usr extends Model<Usr> {
private static final long serialVersionUID = 1L;

@ -1,57 +0,0 @@
package com.foreverwin.mesnac.listener.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.listener.model.UserSchedule;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
import java.util.Set;
/**
* <p>
*
* </p>
*
* @author xqy
* @since 2020-11-09
*/
public interface UserScheduleService extends IService<UserSchedule> {
/**
*
*
* @param frontPage
* @return
*/
IPage<UserSchedule> selectPage(FrontPage<UserSchedule> frontPage, UserSchedule userSchedule);
/**
*
*
* @param userSchedule
* @return
*/
List<UserSchedule> selectList(UserSchedule userSchedule);
/**
* -
*
* @param workCenter
* @param user
* @param scheduleStDt
* @param scheduleEdDt
* @return
*/
List<UserSchedule> getUserScheduleByUserOrWc(String site,String workCenter, String user, String scheduleStDt, String scheduleEdDt);
/**
* -MES-187RULE_01
*
* @param activityBo
* @return
*/
String getActivityRule(String activityBo);
void delAndSave(StringBuffer stringBuffer, List<UserSchedule> addList, Set<String> delList);
}

@ -1,87 +0,0 @@
package com.foreverwin.mesnac.listener.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.listener.mapper.UserScheduleMapper;
import com.foreverwin.mesnac.listener.model.UserSchedule;
import com.foreverwin.mesnac.listener.service.UserScheduleService;
import com.foreverwin.modular.core.util.FrontPage;
import com.sap.me.plant.WorkCenterBOHandle;
import org.eclipse.jetty.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Set;
/**
* <p>
*
* </p>
*
* @author xqy
* @since 2020-11-09
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class UserScheduleServiceImpl extends ServiceImpl<UserScheduleMapper, UserSchedule> implements UserScheduleService {
@Autowired
private UserScheduleMapper userScheduleMapper;
@Override
public IPage<UserSchedule> selectPage(FrontPage<UserSchedule> frontPage, UserSchedule userSchedule) {
QueryWrapper<UserSchedule> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(userSchedule);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<UserSchedule> selectList(UserSchedule userSchedule) {
QueryWrapper<UserSchedule> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(userSchedule);
return super.list(queryWrapper);
}
@Override
public List<UserSchedule> getUserScheduleByUserOrWc(String site, String workCenter, String user, String scheduleStDt, String scheduleEdDt) {
String wcBo = "";
if (!StringUtil.isEmpty(workCenter)) {
WorkCenterBOHandle boHandle = new WorkCenterBOHandle(site, workCenter);
wcBo = boHandle.getValue();
}
return userScheduleMapper.getInfoByUserOrWc(site, workCenter, user, scheduleStDt, scheduleEdDt);
}
@Override
public String getActivityRule(String activityBo) {
String value = "";
UserSchedule userSchedule = userScheduleMapper.getActivityRule(activityBo);
if (userSchedule != null ) {
value = userSchedule.getActivityValue();
}
return value;
}
@Override
public void delAndSave(StringBuffer buffer, List<UserSchedule> addList, Set<String> delSetList) {
if (buffer.length() == 0 && delSetList.size() > 0) {
for(String del: delSetList) {
String[] t = del.split("==");
if (t != null && t.length == 2) {
QueryWrapper<UserSchedule> queryWrapper = new QueryWrapper();
queryWrapper.eq(UserSchedule.USER_NAME, t[0]);
queryWrapper.eq(UserSchedule.SCHEDULE_DATE, t[1]);
remove(queryWrapper);
}
}
}
if (buffer.length() == 0 && addList.size() > 0) {
saveOrUpdateBatch(addList);
}
}
}

@ -1,517 +0,0 @@
<?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.foreverwin.mesnac.listener.mapper.UserScheduleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.listener.model.UserSchedule">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="USER_NAME" property="userName" />
<result column="SCHEDULE_DATE" property="scheduleDate" />
<result column="TYPE" property="type" />
<result column="SCHEDULE_START_TIME" property="scheduleStartTime" />
<result column="SCHEDULE_END_TIME" property="scheduleEndTime" />
<result column="REMARK" property="remark" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="UPDATED_DATE_TIME" property="updatedDateTime" />
<result column="CREATE_USER_BO" property="createUserBo" />
<result column="UPDATE_USER_BO" property="updateUserBo" />
<result column="WEEK" property="week" />
<result column="SHIFT" property="shift" />
<result column="PARENT_BO" property="wc" />
<result column="PARENT_NAME" property="wcName" />
<result column="FULL_NAME" property="userFullName" />
<result column="SETTING" property="activityValue" />
<result column="SHIFT_DESC" property="shiftDesc" />
<result column="GY_SHIFT" property="gyShift" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, USER_NAME, SCHEDULE_DATE, TYPE, SCHEDULE_START_TIME, SCHEDULE_END_TIME, REMARK, CREATED_DATE_TIME, UPDATED_DATE_TIME, CREATE_USER_BO, UPDATE_USER_BO, WEEK, SHIFT
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_USER_SCHEDULE WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_USER_SCHEDULE
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectBatchIds" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_USER_SCHEDULE WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_USER_SCHEDULE
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.userName!=null"> AND USER_NAME=#{ew.entity.userName}</if>
<if test="ew.entity.scheduleDate!=null"> AND SCHEDULE_DATE=#{ew.entity.scheduleDate}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.scheduleStartTime!=null"> AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime}</if>
<if test="ew.entity.scheduleEndTime!=null"> AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
<if test="ew.entity.week!=null"> AND WEEK=#{ew.entity.week}</if>
<if test="ew.entity.shift!=null"> AND SHIFT=#{ew.entity.shift}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_USER_SCHEDULE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.userName!=null"> AND USER_NAME=#{ew.entity.userName}</if>
<if test="ew.entity.scheduleDate!=null"> AND SCHEDULE_DATE=#{ew.entity.scheduleDate}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.scheduleStartTime!=null"> AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime}</if>
<if test="ew.entity.scheduleEndTime!=null"> AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
<if test="ew.entity.week!=null"> AND WEEK=#{ew.entity.week}</if>
<if test="ew.entity.shift!=null"> AND SHIFT=#{ew.entity.shift}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_USER_SCHEDULE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.userName!=null"> AND USER_NAME=#{ew.entity.userName}</if>
<if test="ew.entity.scheduleDate!=null"> AND SCHEDULE_DATE=#{ew.entity.scheduleDate}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.scheduleStartTime!=null"> AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime}</if>
<if test="ew.entity.scheduleEndTime!=null"> AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
<if test="ew.entity.week!=null"> AND WEEK=#{ew.entity.week}</if>
<if test="ew.entity.shift!=null"> AND SHIFT=#{ew.entity.shift}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMaps" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_USER_SCHEDULE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.userName!=null"> AND USER_NAME=#{ew.entity.userName}</if>
<if test="ew.entity.scheduleDate!=null"> AND SCHEDULE_DATE=#{ew.entity.scheduleDate}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.scheduleStartTime!=null"> AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime}</if>
<if test="ew.entity.scheduleEndTime!=null"> AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
<if test="ew.entity.week!=null"> AND WEEK=#{ew.entity.week}</if>
<if test="ew.entity.shift!=null"> AND SHIFT=#{ew.entity.shift}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectObjs" resultType="Object">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_USER_SCHEDULE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.userName!=null"> AND USER_NAME=#{ew.entity.userName}</if>
<if test="ew.entity.scheduleDate!=null"> AND SCHEDULE_DATE=#{ew.entity.scheduleDate}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.scheduleStartTime!=null"> AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime}</if>
<if test="ew.entity.scheduleEndTime!=null"> AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
<if test="ew.entity.week!=null"> AND WEEK=#{ew.entity.week}</if>
<if test="ew.entity.shift!=null"> AND SHIFT=#{ew.entity.shift}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectPage" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_USER_SCHEDULE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.userName!=null"> AND USER_NAME=#{ew.entity.userName}</if>
<if test="ew.entity.scheduleDate!=null"> AND SCHEDULE_DATE=#{ew.entity.scheduleDate}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.scheduleStartTime!=null"> AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime}</if>
<if test="ew.entity.scheduleEndTime!=null"> AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
<if test="ew.entity.week!=null"> AND WEEK=#{ew.entity.week}</if>
<if test="ew.entity.shift!=null"> AND SHIFT=#{ew.entity.shift}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMapsPage" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_USER_SCHEDULE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.userName!=null"> AND USER_NAME=#{ew.entity.userName}</if>
<if test="ew.entity.scheduleDate!=null"> AND SCHEDULE_DATE=#{ew.entity.scheduleDate}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.scheduleStartTime!=null"> AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime}</if>
<if test="ew.entity.scheduleEndTime!=null"> AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
<if test="ew.entity.week!=null"> AND WEEK=#{ew.entity.week}</if>
<if test="ew.entity.shift!=null"> AND SHIFT=#{ew.entity.shift}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.listener.model.UserSchedule">
INSERT INTO Z_USER_SCHEDULE
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="userName!=null">USER_NAME,</if>
<if test="scheduleDate!=null">SCHEDULE_DATE,</if>
<if test="type!=null">TYPE,</if>
<if test="scheduleStartTime!=null">SCHEDULE_START_TIME,</if>
<if test="scheduleEndTime!=null">SCHEDULE_END_TIME,</if>
<if test="remark!=null">REMARK,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="updatedDateTime!=null">UPDATED_DATE_TIME,</if>
<if test="createUserBo!=null">CREATE_USER_BO,</if>
<if test="updateUserBo!=null">UPDATE_USER_BO,</if>
<if test="week!=null">WEEK,</if>
<if test="shift!=null">SHIFT,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="userName!=null">#{userName},</if>
<if test="scheduleDate!=null">#{scheduleDate},</if>
<if test="type!=null">#{type},</if>
<if test="scheduleStartTime!=null">#{scheduleStartTime},</if>
<if test="scheduleEndTime!=null">#{scheduleEndTime},</if>
<if test="remark!=null">#{remark},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="updatedDateTime!=null">#{updatedDateTime},</if>
<if test="createUserBo!=null">#{createUserBo},</if>
<if test="updateUserBo!=null">#{updateUserBo},</if>
<if test="week!=null">#{week},</if>
<if test="shift!=null">#{shift},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.listener.model.UserSchedule">
INSERT INTO Z_USER_SCHEDULE
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{userName},
#{scheduleDate},
#{type},
#{scheduleStartTime},
#{scheduleEndTime},
#{remark},
#{createdDateTime},
#{updatedDateTime},
#{createUserBo},
#{updateUserBo},
#{week},
#{shift},
</trim>
</insert>
<update id="updateById">
UPDATE Z_USER_SCHEDULE <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.userName!=null">USER_NAME=#{et.userName},</if>
<if test="et.scheduleDate!=null">SCHEDULE_DATE=#{et.scheduleDate},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.scheduleStartTime!=null">SCHEDULE_START_TIME=#{et.scheduleStartTime},</if>
<if test="et.scheduleEndTime!=null">SCHEDULE_END_TIME=#{et.scheduleEndTime},</if>
<if test="et.remark!=null">REMARK=#{et.remark},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.updatedDateTime!=null">UPDATED_DATE_TIME=#{et.updatedDateTime},</if>
<if test="et.createUserBo!=null">CREATE_USER_BO=#{et.createUserBo},</if>
<if test="et.updateUserBo!=null">UPDATE_USER_BO=#{et.updateUserBo},</if>
<if test="et.week!=null">WEEK=#{et.week},</if>
<if test="et.shift!=null">SHIFT=#{et.shift},</if>
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="updateAllColumnById">
UPDATE Z_USER_SCHEDULE <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
USER_NAME=#{et.userName},
SCHEDULE_DATE=#{et.scheduleDate},
TYPE=#{et.type},
SCHEDULE_START_TIME=#{et.scheduleStartTime},
SCHEDULE_END_TIME=#{et.scheduleEndTime},
REMARK=#{et.remark},
CREATED_DATE_TIME=#{et.createdDateTime},
UPDATED_DATE_TIME=#{et.updatedDateTime},
CREATE_USER_BO=#{et.createUserBo},
UPDATE_USER_BO=#{et.updateUserBo},
WEEK=#{et.week},
SHIFT=#{et.shift},
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="update">
UPDATE Z_USER_SCHEDULE <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.userName!=null">USER_NAME=#{et.userName},</if>
<if test="et.scheduleDate!=null">SCHEDULE_DATE=#{et.scheduleDate},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.scheduleStartTime!=null">SCHEDULE_START_TIME=#{et.scheduleStartTime},</if>
<if test="et.scheduleEndTime!=null">SCHEDULE_END_TIME=#{et.scheduleEndTime},</if>
<if test="et.remark!=null">REMARK=#{et.remark},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.updatedDateTime!=null">UPDATED_DATE_TIME=#{et.updatedDateTime},</if>
<if test="et.createUserBo!=null">CREATE_USER_BO=#{et.createUserBo},</if>
<if test="et.updateUserBo!=null">UPDATE_USER_BO=#{et.updateUserBo},</if>
<if test="et.week!=null">WEEK=#{et.week},</if>
<if test="et.shift!=null">SHIFT=#{et.shift},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.userName!=null"> AND USER_NAME=#{ew.entity.userName}</if>
<if test="ew.entity.scheduleDate!=null"> AND SCHEDULE_DATE=#{ew.entity.scheduleDate}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.scheduleStartTime!=null"> AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime}</if>
<if test="ew.entity.scheduleEndTime!=null"> AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
<if test="ew.entity.week!=null"> AND WEEK=#{ew.entity.week}</if>
<if test="ew.entity.shift!=null"> AND SHIFT=#{ew.entity.shift}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteById">
DELETE FROM Z_USER_SCHEDULE WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_USER_SCHEDULE
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM Z_USER_SCHEDULE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.userName!=null"> AND USER_NAME=#{ew.entity.userName}</if>
<if test="ew.entity.scheduleDate!=null"> AND SCHEDULE_DATE=#{ew.entity.scheduleDate}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.scheduleStartTime!=null"> AND SCHEDULE_START_TIME=#{ew.entity.scheduleStartTime}</if>
<if test="ew.entity.scheduleEndTime!=null"> AND SCHEDULE_END_TIME=#{ew.entity.scheduleEndTime}</if>
<if test="ew.entity.remark!=null"> AND REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
<if test="ew.entity.week!=null"> AND WEEK=#{ew.entity.week}</if>
<if test="ew.entity.shift!=null"> AND SHIFT=#{ew.entity.shift}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<delete id="deleteBatchIds">
DELETE FROM Z_USER_SCHEDULE WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<!-- 根据班课查询排班人员信息 -->
<select id="getInfoByUserOrWc" resultMap="BaseResultMap">
SELECT
DISTINCT
ZWO.PARENT_BO,
ZWO.PARENT_NAME,
NU.FULL_NAME,
ZUS.*,
US.DESCRIPTION SHIFT_DESC
FROM
Z_USER_SCHEDULE ZUS
INNER JOIN Z_NWA_USER NU ON UPPER(NU.USER_NAME) = UPPER(ZUS.USER_NAME) AND NU.SITE = ZUS.SITE
LEFT JOIN USER_SHIFT US ON US.NAME = ZUS.SHIFT AND US.SITE = ZUS.SITE
LEFT JOIN Z_WORK_CENTER_USER ZWCU ON ZWCU.USER_BO = ZUS.USER_NAME AND ZWCU.SITE = ZUS.SITE
LEFT JOIN WORK_CENTER_MEMBER WCM ON 'WorkCenterBO:' || ZWCU.SITE || ',' || ZWCU.WORK_CENTER_BO = WCM.WORK_CENTER_OR_RESOURCE_GBO
LEFT JOIN Z_WORKSHOP_ORGANIZATION ZWO1 ON WCM.WORK_CENTER_BO = 'WorkCenterBO:' || ZWO1.SITE || ',' || ZWO1.NAME AND ZWO1.LEVEL = '3'
LEFT JOIN Z_WORKSHOP_ORGANIZATION ZWO ON ZWO.NAME = ZWO1.PARENT_BO AND ZWO.LEVEL = '2' AND ZWO1.SITE = #{site}
WHERE
ZUS.SITE = #{site}
<if test="scheduleStDt!=null and scheduleStDt!=''">
AND ZUS.SCHEDULE_DATE <![CDATA[ >= ]]> #{scheduleStDt}
</if>
<if test="scheduleEdDt!=null and scheduleEdDt!=''">
AND ZUS.SCHEDULE_DATE <![CDATA[ <= ]]> #{scheduleEdDt}
</if>
<if test="wcBo!=null and wcBo!=''">
AND ZWO.PARENT_BO = #{wcBo}
</if>
<if test="user!=null and user!=''">
AND UPPER(ZUS.USER_NAME) = UPPER(#{user})
</if>
</select>
<!-- 查找作业规则 -->
<select id="getActivityRule" resultMap="BaseResultMap" >
SELECT SETTING FROM ACTIVITY_OPTION WHERE ACTIVITY_BO = #{activityBo}
AND EXEC_UNIT_OPTION = 'RULE_01'
</select>
<!--与盖亚班次映射关系-->
<select id="getShiftMappingGyAndMe" resultMap="BaseResultMap">
SELECT dfl.DATA_VALUE AS GY_SHIFT,dflt.DATA_TAG AS SHIFT
FROM DATA_FIELD df
INNER JOIN DATA_FIELD_LIST dfl ON df.HANDLE = dfl.DATA_FIELD_BO
INNER JOIN DATA_FIELD_LIST_T dflt ON dfl.HANDLE = dflt.DATA_FIELD_LIST_BO
WHERE df.SITE = #{site} AND df.DATA_FIELD = 'SHIFT_MAPPING' AND dflt.LOCALE = 'zh'
</select>
</mapper>
Loading…
Cancel
Save