赫艾后端
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.
 
 
 
 
 
 

385 lines
13 KiB

var userId = $("#current_username").val();
var userName = $("#current_username").val();
var site = $("#current_site").val();
var titleName = $("#current_titleName").val();
var currentData = null;
var wareHouseList = new Array();
var wareHouseData = null;
var batchType = "";
//页面初始化
$(function(){
if(titleName != null && titleName != ""){
$("#titleName").text(titleName);
}else {
window.location.href="/login";
}
var workData = $.cookie("transFer");
if(workData != null && workData !==""){
currentData = JSON.parse(workData);
$("#warehouseQty").val(currentData.lotSize);
if(currentData.weightFactor!='0'&&currentData.weightFactor!=''&&currentData.weightFactor!=null){
$("#warehouseQtyKG").val((currentData.lotSize*currentData.weightFactor).toFixed(1));
}else {
$("#warehouseQtyKG").val("erp未维护数据");
}
}
InfoDates("warehousingDate");
getWarehouse()
getBatchType()
// 初始化光标
$("#orderNo_search").focus();
});
// 获取库位信息
function getWarehouse(){
let jsonData = {
site : currentData.site,
userId : userId,
functionName : "Get_Users_AccessWarehouse_List",
}
$.ajax({
url: "/pdaOrder/getUsersAccessWarehouseList",
contentType: 'application/json',
type:"POST",
data:JSON.stringify(jsonData),//你的formid
dataType:"JSON",
beforeSend: function(request) {
request.setRequestHeader("token", $.cookie("token"));
},
success: function (data) {
var list = data.rows;
if(list != null && list.length > 0){
wareHouseList = list;
var departmentTags = '';
for(var i = 0; i< list.length; i++){
if(list[i].Active != null && list[i].Active === "Y" && list[i].WareHouseType_DB != null && list[i].WareHouseType_DB === "P"){
departmentTags += '<option value="'+list[i].WareHouseID+'">'+list[i].WareHouseName+'</option>';
}
}
$("#warehouse_id").html(departmentTags).change();
if(currentData.defaultWarehouseID!=''&&currentData.defaultWarehouseID!=null){
$("#warehouse_id").val(currentData.defaultWarehouseID)
}
warehouseChange()
}
},
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');
}
})
}
//生产出库工单失去焦点事件
$('#warehouseQtyKG').blur(function () {
let warehouseQtyKG=$('#warehouseQtyKG').val();
let weightFactor=currentData.weightFactor;
if(weightFactor!=0&&weightFactor!=-1&&warehouseQtyKG!=''){
$('#warehouseQty').val((warehouseQtyKG/weightFactor).toFixed(1))
}
if(warehouseQtyKG==''){
$('#warehouseQty').val("")
}
})
//生产出库工单失去焦点事件
$('#warehouseQty').blur(function () {
let warehouseQty=$('#warehouseQty').val();
let weightFactor=currentData.weightFactor;
if(weightFactor!=0&&weightFactor!=-1&&warehouseQty!=''){
$('#warehouseQtyKG').val((warehouseQty*weightFactor).toFixed(1))
}
if(warehouseQty==''){
$('#warehouseQtyKG').val("")
}
})
// 获取批号信息
function getBatchType(){
let jsonData = {
site : currentData.site,
partNo : currentData.partNo,
functionName : "dbo.Get_Part_BatchCreatedMethod",
}
$.ajax({
url: "/pdaOrder/getPartBatchCreatedMethod",
contentType: 'application/json',
type:"POST",
data:JSON.stringify(jsonData),//你的formid
dataType:"JSON",
beforeSend: function(request) {
request.setRequestHeader("token", $.cookie("token"));
},
success: function (data) {
if(data.code == 0){
batchType = data.result;
$("#batchNo").val("");
if(batchType == "基于入库单单号" || batchType == "基于入库时间" ){
$('#batchNo').attr("disabled",true);
}else if(batchType == "不采用批号"){
$("#batchNo").val("*");
$('#batchNo').attr("disabled",true);
}else {
$('#batchNo').attr("disabled",false);
}
}
},
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 warehouseChange(){
var warehouseId = $("#warehouse_id").val();
for (var i = 0; i < wareHouseList.length; i++) {
if(wareHouseList[i].WareHouseID == warehouseId){
$("#locationId").val("");
wareHouseData = wareHouseList[i];
if(wareHouseList[i].UseLocation != null && wareHouseList[i].UseLocation === "Y"){
$("#locationId").val("");
$('#locationId').attr("disabled",false);
}else {
$("#locationId").val("*");
$('#locationId').attr("disabled",true);
}
break
}
}
}
//为报废原因绑定一个失去焦点事件
$("#warehouse_id").change(function() {
warehouseChange()
})
// 获取获取工具实例编码
function receiveFlag(){
var warehouseDate = $("#warehousingDate").val();
var warehouseQty = $("#warehouseQty").val();
var warehouseId = $("#warehouse_id").val().toUpperCase();
var locationId = $("#locationId").val().toUpperCase();
var batchNo = $("#batchNo").val();
var printNumber = $("#printNumber").val();
if(warehouseDate == null || warehouseDate === ""){
layer.msg("请选择入库日期!");
return false
}
if(warehouseQty == null || warehouseQty === "" || warehouseQty <=0){
layer.msg("请输入入库数量!");
return false
}
if(warehouseId == null || warehouseId === ""){
layer.msg("请选择仓库!");
return false
}
if( wareHouseData.UseLocation === "Y" &&(locationId == null || locationId === "")){
layer.msg("请输入库位!");
return false
}
if(batchType != "基于入库单单号" && batchType != "基于入库时间" && batchType != "不采用批号"){
if(batchNo == null || batchNo === ""){
layer.msg("请输入批号!");
return false
}
}
if(printNumber == null || printNumber === "" || printNumber === "0"){
layer.msg("请填写要打印的标签打印数量!");
return false
}
let jsonData = {
site : currentData.site,
/*warehouseDate : warehouseDate,
warehouseId : warehouseId,
locationId : locationId,
batchNo : batchNo,
remark : remark,*/
transQty : warehouseQty,
functionName : "SO_Receive_FG_Confirm",
orderNo : currentData.orderNo,
}
$.ajax({
url: "/pdaOrder/getSOReceiveFGConfirm",
contentType: 'application/json',
type:"POST",
data:JSON.stringify(jsonData),//你的formid
dataType:"JSON",
beforeSend: function(request) {
request.setRequestHeader("token", $.cookie("token"));
},
success: function (data) {
if(data.code == 200){
saveProduction()
}else {
layer.confirm(data.msg, {
btn : [ '确定', '取消' ]
// 按钮
}, function() {
saveProduction();
}, function() {
});
}
},
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 saveProduction(){
var warehouseDate = $("#warehousingDate").val();
var warehouseQty = $("#warehouseQty").val();
var warehouseId = $("#warehouse_id").val().toUpperCase();
var locationId = $("#locationId").val().toUpperCase();
var batchNo = $("#batchNo").val();
var remark = $("#remark").val();
var printNumber = $("#printNumber").val();
let strSeqNo='00000'+currentData.seqNo;
let scanList = JSON.parse(localStorage.getItem("scanList"))[0];
let jsonData = {
site : currentData.site,
orderNo : currentData.orderNo,
transDate : warehouseDate,
warehouseId : warehouseId,
partnerId : "",
partNo : currentData.partNo,
batchNo : currentData.orderNo.substring(4)+'-'+strSeqNo.substring(strSeqNo.length-5),
locationId : locationId,
transQty : warehouseQty,
userId : userId,
receiver : userName,
remark : remark,
transFerNo:currentData.transFerNo,
printNumber:printNumber,
functionName : "[dbo].[SO_Receive_FG_TransFer]",
useLocationFlag:wareHouseData.UseLocation,
scanList:scanList,
}
$.ajax({
url: "/pdaOrder/saveSOReceiveFGTransFer",
contentType: 'application/json',
type:"POST",
data:JSON.stringify(jsonData),//你的formid
dataType:"JSON",
beforeSend: function(request) {
request.setRequestHeader("token", $.cookie("token"));
},
success: function (data) {
// layer.msg(data.msg);
if(data.code == 0){
// cleanInput()
pdaBaseJump2()
localStorage.removeItem("scanList");
}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 cleanInput(){
$("#warehouseQty").val(0);
$("#batchNo").val("");
$("#remark").val("");
$("#warehouse_id option:first").prop("selected", 'selected').change();
}
//回退上一步
function pdaBaseJump(){
var menuId = $("#menuId").val();
var titleName = "回退";
window.location.href = "/pda/transferWarehousingScanLabel?menuId=" +menuId +"&titleName=" +titleName;
}
//下级界面页面跳转
function pdaBaseJump2(){
var menuId = $("#menuId").val();
var titleName = '不要缓存';
window.location.href = "/pda/transferWarehousing?menuId=" +menuId +"&titleName=" +titleName;
}
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个值
});
}