1,根据效期批量转移任务生成
parent
d2b5f03639
commit
57ea4dbfb8
|
@ -157,7 +157,36 @@ public class WmToMoveGoodsController extends BaseController {
|
|||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除库存转移
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doBatchUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchUpdate(String ids,String moveSta,HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "批量设置状态成功";
|
||||
try{
|
||||
for(String id:ids.split(",")){
|
||||
WmToMoveGoodsEntity wmToMoveGoods = systemService.getEntity(WmToMoveGoodsEntity.class,
|
||||
id
|
||||
);
|
||||
wmToMoveGoods.setMoveSta(moveSta);
|
||||
wmToMoveGoodsService.updateEntitie(wmToMoveGoods);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "批量设置状态失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除库存转移
|
||||
*
|
||||
|
@ -188,6 +217,8 @@ public class WmToMoveGoodsController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping(params = "doGetstock", method = { RequestMethod.GET,
|
||||
RequestMethod.POST })
|
||||
@ResponseBody
|
||||
|
|
|
@ -71,6 +71,9 @@ public class WvStockEntity implements java.io.Serializable {
|
|||
/**保质期*/
|
||||
@Excel(name="保质期")
|
||||
private java.lang.String bzhiQi;
|
||||
//允收天数
|
||||
private java.lang.String yushoutianshu;
|
||||
|
||||
/**单位*/
|
||||
@Excel(name="单位")
|
||||
private java.lang.String goodsUnit;
|
||||
|
@ -363,5 +366,12 @@ public class WvStockEntity implements java.io.Serializable {
|
|||
public void setMoveSta(java.lang.String moveSta) {
|
||||
this.moveSta = moveSta;
|
||||
}
|
||||
|
||||
@Column(name ="yushoutianshu",nullable=true,length=36)
|
||||
public String getYushoutianshu() {
|
||||
return yushoutianshu;
|
||||
}
|
||||
|
||||
public void setYushoutianshu(String yushoutianshu) {
|
||||
this.yushoutianshu = yushoutianshu;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,40 +61,53 @@ public class GoodsMoveTask {
|
|||
org.jeecgframework.core.util.LogUtil.info("转移定时任务总耗时" + times + "毫秒");
|
||||
}
|
||||
public void goodsMove(String binstrore,String moveStatus ){
|
||||
//转移到B
|
||||
String tsql = "SELECT id FROM zzjee.wv_stock_stt " +
|
||||
"where yushoutianshu <> bzhi_qi " +
|
||||
"and bzhi_qi > 0 " +
|
||||
"and bin_id = 'A' " +
|
||||
"and to_days(`goods_pro_data` + interval (bzhi_qi - yushoutianshu) day) < to_days(now()) " +
|
||||
"and to_days(`goods_pro_data` + interval (bzhi_qi ) day) > to_days(now())";
|
||||
this.genGoodsMove(tsql,"B","",moveStatus);
|
||||
|
||||
String tsql = "";
|
||||
List<Map<String, Object>> resulmove = systemService
|
||||
.findForJdbc(tsql, binstrore);
|
||||
//生成任务
|
||||
for (int i = 0; i < resulmove.size(); i++) {
|
||||
|
||||
WvStockEntity t = systemService.get(WvStockEntity.class,resulmove.get(i).get("id").toString());
|
||||
try {
|
||||
WmToMoveGoodsEntity wmtomove = new WmToMoveGoodsEntity();
|
||||
wmtomove.setOrderTypeCode("TPZY");
|
||||
wmtomove.setBinFrom(t.getKuWeiBianMa());
|
||||
wmtomove.setBinTo(t.getKuWeiBianMa());
|
||||
wmtomove.setCusCode(t.getCusCode());
|
||||
wmtomove.setCusName(t.getZhongWenQch());
|
||||
wmtomove.setToCusCode(t.getCusCode());
|
||||
wmtomove.setToCusName(t.getZhongWenQch());
|
||||
wmtomove.setGoodsId(t.getGoodsId());
|
||||
wmtomove.setGoodsName(t.getShpMingCheng());
|
||||
wmtomove.setGoodsProData(t.getGoodsProData());
|
||||
wmtomove.setGoodsQua(t.getGoodsQua().toString());
|
||||
wmtomove.setGoodsUnit(t.getGoodsUnit());
|
||||
wmtomove.setBaseGoodscount(t.getGoodsQua().toString());
|
||||
wmtomove.setBaseUnit(t.getGoodsUnit());
|
||||
wmtomove.setMoveSta(moveStatus);
|
||||
wmtomove.setTinFrom(t.getBinId());
|
||||
wmtomove.setTinId("B");
|
||||
systemService.save(wmtomove);
|
||||
}catch (Exception e){
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//转移到C
|
||||
tsql = "SELECT id FROM zzjee.wv_stock_stt " +
|
||||
"where yushoutianshu <> bzhi_qi " +
|
||||
"and bzhi_qi > 0 " +
|
||||
"and bin_id in ('A','B') " +
|
||||
"and to_days(`goods_pro_data` + interval (bzhi_qi ) day) <= to_days(now())";
|
||||
this.genGoodsMove(tsql,"C","",moveStatus);
|
||||
}
|
||||
|
||||
private void genGoodsMove(String Tsql,String TinId,String binstrore,String moveStatus ){
|
||||
List<Map<String, Object>> resulmovea = systemService
|
||||
.findForJdbc(Tsql, binstrore);
|
||||
//生成任务转B
|
||||
for (int i = 0; i < resulmovea.size(); i++) {
|
||||
WvStockEntity t = systemService.get(WvStockEntity.class,resulmovea.get(i).get("id").toString());
|
||||
try {
|
||||
WmToMoveGoodsEntity wmtomove = new WmToMoveGoodsEntity();
|
||||
wmtomove.setOrderTypeCode("TPZY");
|
||||
wmtomove.setBinFrom(t.getKuWeiBianMa());
|
||||
wmtomove.setBinTo(t.getKuWeiBianMa());
|
||||
wmtomove.setCusCode(t.getCusCode());
|
||||
wmtomove.setCusName(t.getZhongWenQch());
|
||||
wmtomove.setToCusCode(t.getCusCode());
|
||||
wmtomove.setToCusName(t.getZhongWenQch());
|
||||
wmtomove.setGoodsId(t.getGoodsId());
|
||||
wmtomove.setGoodsName(t.getShpMingCheng());
|
||||
wmtomove.setGoodsProData(t.getGoodsProData());
|
||||
wmtomove.setGoodsQua(t.getGoodsQua().toString());
|
||||
wmtomove.setGoodsUnit(t.getGoodsUnit());
|
||||
wmtomove.setBaseGoodscount(t.getGoodsQua().toString());
|
||||
wmtomove.setBaseUnit(t.getGoodsUnit());
|
||||
wmtomove.setMoveSta(moveStatus);
|
||||
wmtomove.setTinFrom(t.getBinId());
|
||||
wmtomove.setTinId(TinId);
|
||||
systemService.save(wmtomove);
|
||||
}catch (Exception e){
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
<t:dgToolBar title="选择批量更改" icon="icon-edit" funname="editRow"></t:dgToolBar>
|
||||
<t:dgToolBar title="批量保存" icon="icon-save" url="wmToMoveGoodsController.do?saveRows" funname="saveData"></t:dgToolBar>
|
||||
<t:dgToolBar title="取消批量更改" icon="icon-undo" funname="reject"></t:dgToolBar>
|
||||
<t:dgToolBar title="批量确定转移" funname="dobatchUpdate"></t:dgToolBar>
|
||||
|
||||
<t:dgToolBar title="批量删除" icon="icon-remove" url="wmToMoveGoodsController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
|
||||
<t:dgToolBar title="查看" icon="icon-search" url="wmToMoveGoodsController.do?goUpdate" funname="detail"></t:dgToolBar>
|
||||
|
@ -58,6 +59,40 @@
|
|||
});
|
||||
|
||||
|
||||
function dobatchUpdate(){
|
||||
var moveSta = "已完成";
|
||||
|
||||
var ids = [];
|
||||
var rows = $('#wmToMoveGoodsList').datagrid('getSelections');
|
||||
|
||||
for(var i=0; i<rows.length; i++){
|
||||
if(rows[i].moveSta=="计划中"){
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
}
|
||||
if(ids.size<=0){
|
||||
alert("请选择数据");
|
||||
}else{
|
||||
var url = "wmToMoveGoodsController.do?doBatchUpdate&ids="+ids+"&moveSta="+moveSta;
|
||||
$.ajax({
|
||||
async : false,
|
||||
cache : false,
|
||||
type : 'POST',
|
||||
url : url,// 请求的action路径
|
||||
error : function() {// 请求失败处理函数
|
||||
},
|
||||
success : function(data) {
|
||||
var d = $.parseJSON(data);
|
||||
if (d.success) {
|
||||
tip("批量设置状态已完成成功");
|
||||
$('#wmToMoveGoodsList').datagrid('reload',{});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//保存数据
|
||||
function saveData(title,addurl,gname){
|
||||
|
|
Loading…
Reference in New Issue