You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
262 lines
7.5 KiB
262 lines
7.5 KiB
var userId = $("#current_id").val();
|
|
var userName = $("#current_username").val();
|
|
var site = $("#current_site").val();
|
|
|
|
var titleName = $("#current_titleName").val();
|
|
|
|
var currentData = null;
|
|
|
|
var soBomList = new Array();
|
|
|
|
var wareHouseId = '';
|
|
|
|
var partNoData = null;
|
|
|
|
var inventoryData = null;
|
|
|
|
var tableList = new Array();
|
|
|
|
var showTableList = new Array();
|
|
|
|
//页面初始化
|
|
$(function(){
|
|
if(titleName != null && titleName != ""){
|
|
$("#titleName").text(titleName);
|
|
}else {
|
|
window.location.href="/login";
|
|
}
|
|
var proIssueData = $.cookie("proIssueData");
|
|
if(proIssueData != null && proIssueData !==""){
|
|
currentData = JSON.parse(proIssueData);
|
|
}
|
|
InfoDates("outStrDate");
|
|
var list = $.cookie("tableList");
|
|
tableList = JSON.parse(list);
|
|
changeTableList()
|
|
});
|
|
|
|
function changeTableList(){
|
|
showTableList = new Array();
|
|
for (let i = 0; i < tableList.length; i++) {
|
|
var indexData = JSON.parse(JSON.stringify(tableList[i]));
|
|
var flag = true;
|
|
for (let j = 0; j < showTableList.length; j++) {
|
|
if(tableList[i].partNo == showTableList[j].partNo){
|
|
showTableList[j].qtyIssue = parseFloat(tableList[i].qtyIssue) + parseFloat(showTableList[j].qtyIssue);
|
|
flag = false
|
|
}
|
|
}
|
|
if(flag){
|
|
showTableList.push(indexData);
|
|
}
|
|
|
|
}
|
|
changeTable();
|
|
}
|
|
|
|
function changeTable(){
|
|
var str = '';
|
|
$("#wareHouse").val(showTableList[0].warehouseId + "-" + showTableList[0].wareHouseName);
|
|
for (let i = 0; i < showTableList.length; i++) {
|
|
str += '<tr id = '+showTableList[i].partNo +'>' +
|
|
'<th class="" style="text-align:center;background-color: #ffff;width: 15%;">' +
|
|
'<span>'+showTableList[i].partNo+'</span></th>' +
|
|
'<th class="" style="text-align:center;background-color: #ffff;width: 15%;">' +
|
|
'<span>'+showTableList[i].qtyReady+'</span></th>' +
|
|
'<th class="" style="text-align:center;background-color: #ffff;width: 15%;">' +
|
|
'<span>'+showTableList[i].qtyIssue+'</span></th>' +
|
|
'<th class="" style="text-align:center;background-color: #ffff;width: 30%;">' +
|
|
'<span>'+showTableList[i].partDescSpec+'</span></th>' +
|
|
'<th class="" style="text-align:center;background-color: #ffff;width: 10%;">' +
|
|
'<span>'+showTableList[i].umid+'</span></th>' +
|
|
'</tr>';
|
|
}
|
|
$("#issue_table").html("").append(str);
|
|
$("#issue_cancel").click();
|
|
}
|
|
|
|
|
|
function saveList(){
|
|
var wareHouse = $("#wareHouse").val();
|
|
if(wareHouse != null && wareHouse != ""){
|
|
if(wareHouseId != partNoData.wareHouseId){
|
|
layer.msg("仓库编码错误!");
|
|
return false
|
|
}
|
|
}
|
|
var jsonData = {
|
|
site : partNoData.site,
|
|
warehouseId : partNoData.wareHouseId,
|
|
batchNo : partNoData.batchNo,
|
|
locationId : partNoData.locationId,
|
|
partNo : partNoData.partNo,
|
|
}
|
|
$.ajax({
|
|
url: "/pdaOrder/getInventoryStockData",
|
|
contentType: 'application/json',
|
|
type:"POST",
|
|
data:JSON.stringify(jsonData),//你的formid
|
|
dataType:"JSON",
|
|
async: true,
|
|
beforeSend: function(request) {
|
|
request.setRequestHeader("token", $.cookie("token"));
|
|
},
|
|
success: function (data) {
|
|
if(data.code == 0){
|
|
var row = data.row;
|
|
if(row != null && row.site != null){
|
|
inventoryData = row;
|
|
wareHouseId = row.warehouseId;
|
|
$("#wareHouse").val(row.warehouseId + "-" + row.wareHouseName);
|
|
initIssueModel();
|
|
}else {
|
|
layer.msg("仓库无此物料信息!");
|
|
}
|
|
}else {
|
|
layer.msg(data.msg);
|
|
}
|
|
},
|
|
error: function(data) {
|
|
var responseText = data.responseText;
|
|
var json_str = JSON.parse(responseText);
|
|
var status = json_str.status;
|
|
var message = json_str.message;
|
|
//判断是否是session超时
|
|
if(403==status){
|
|
layer.alert(message,function(){
|
|
window.location.href="/login";
|
|
});
|
|
}
|
|
layer.closeAll('loading');
|
|
}
|
|
})
|
|
}
|
|
|
|
function saveIssueList(){
|
|
if(tableList.length <= 0){
|
|
layer.msg("当前无发料信息!");
|
|
return false;
|
|
}
|
|
var checkFlag = $("#curr_checkbox").is(':checked');
|
|
var StockFlag = 'N';
|
|
if (checkFlag){
|
|
StockFlag = 'Y';
|
|
}
|
|
var jsonList = new Array();
|
|
for (let i = 0; i < tableList.length; i++) {
|
|
var jsonData = {
|
|
site : currentData.site,
|
|
warehouseId : tableList[i].warehouseId,
|
|
transTypeDb : 'SI',
|
|
userId : userId,
|
|
receiver : '',
|
|
partnerType : 'D',
|
|
partnerId : '',
|
|
remark : '',
|
|
orderNo : currentData.orderNo,
|
|
projectId : '',
|
|
transNo : '',
|
|
transItemNo : 0,
|
|
partNo : tableList[i].partNo,
|
|
batchNo : tableList[i].batchNo,
|
|
locationId : tableList[i].locationId,
|
|
transQty : tableList[i].qtyIssue,
|
|
costGroupId : '',
|
|
orderRef1 : currentData.orderNo,
|
|
orderRef2 : tableList[i].itemNo,
|
|
orderRef3 : currentData.seqNo,
|
|
allowNegativeStockFlag : StockFlag,
|
|
seqNo:currentData.seqNo,
|
|
transDate:$("#outStrDate").val()
|
|
}
|
|
jsonList.push(jsonData);
|
|
}
|
|
$.ajax({
|
|
url: "/pdaOrder/saveSaveTrans",
|
|
contentType: 'application/json',
|
|
type:"POST",
|
|
data:JSON.stringify(jsonList),//你的formid
|
|
dataType:"JSON",
|
|
async: true,
|
|
beforeSend: function(request) {
|
|
request.setRequestHeader("token", $.cookie("token"));
|
|
},
|
|
success: function (data) {
|
|
layer.open({
|
|
content: data.msg,
|
|
yes:function(index,layero){
|
|
if(data.code === 0){
|
|
window.location.href="/pda/pdaBase";
|
|
}else {
|
|
layer.close(index); //关闭弹出框
|
|
}
|
|
}
|
|
})
|
|
},
|
|
error: function(data) {
|
|
var responseText = data.responseText;
|
|
var json_str = JSON.parse(responseText);
|
|
var status = json_str.status;
|
|
var message = json_str.message;
|
|
//判断是否是session超时
|
|
if(403==status){
|
|
layer.alert(message,function(){
|
|
window.location.href="/login";
|
|
});
|
|
}
|
|
layer.closeAll('loading');
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
//下级界面页面跳转
|
|
function pageJump(){
|
|
$.cookie("tableList",JSON.stringify(tableList));
|
|
var menuId = $("#menuId").val();
|
|
var superiorName = $("#current_titleName").val();
|
|
window.location.href = "/pda/productionIssue4?menuId=" + menuId + "&titleName=" + superiorName;
|
|
}
|
|
|
|
//下级界面页面跳转
|
|
function superiorJump(){
|
|
var menuId = $("#menuId").val();
|
|
var superiorName = $("#current_titleName").val();
|
|
window.location.href = "/pda/productionIssue3?menuId=" + menuId + "&titleName=" + superiorName;
|
|
}
|
|
|
|
function InfoDates(date){
|
|
var default_date = getNowFormatDate();
|
|
$("#" + date).val(default_date);
|
|
//初始化模态框的日期
|
|
$.fn.datetimepicker.dates['zh-CN'] = {
|
|
days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
|
|
daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
|
|
daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
|
|
months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
|
monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
|
today: "今天",
|
|
suffix: [],
|
|
meridiem: ["上午", "下午"]
|
|
};
|
|
$("#"+date).datetimepicker({
|
|
format : 'yyyy-mm-dd',//显示格式
|
|
maxView : 4,//最高能展示的时间,Number, String类型 默认值:4, 年
|
|
minView : 2,//日期时间选择器所能够提供的最精确的时间选择视图
|
|
autoclose : true,//选择后自动关闭
|
|
todayBtn : true,//开启选择今天的按钮
|
|
todayHighlight: true,//今天日期高亮显示 如果为true, 高亮当前日期。Boolean类型 ,默认值:false ,
|
|
language : 'zh-CN'//语言选择中文
|
|
});
|
|
}
|
|
|
|
//初始化下拉框
|
|
function selectInit(){
|
|
$('.selectpicker').selectpicker({
|
|
noneSelectedText: '',
|
|
noneResultsText: '',
|
|
liveSearch: true,
|
|
width:140,
|
|
size:5 //设置select高度,同时显示5个值
|
|
});
|
|
}
|