//Controller
public function abnormalDistributionStatisticsAction() {
$opCode = $this->_request->getParam("orders_code_ch", "");
$opMore = $this->_request->getParam("op_more", "");
$opWrong = $this->_request->getParam("op_wrong", "");
$opLeakage = $this->_request->getParam("op_leakage", "");
$noAbnormalities = $this->_request->getParam("no_abnormalities", "");
$return = array("ask" => 0, "msg" => "");
$opId = Order_Service_OrderPickup::getByValue($opCode, "op_code");
if (!$opId) {
$return['msg'] = "请输入下架单号";
} else {
if ($noAbnormalities == 1) {
if (($opMore == "" && $opWrong == "" && $opLeakage == "") || ($opMore == 0 && $opWrong == 0 && $opLeakage == 0)) {
$return = array("ask" => 1, "msg" => "配货异常统计成功");
} else {
$return = array("ask" => 0, "msg" => "配货异常数量跟无异常不能同时存在");
}
die(json_encode($return));
} else {
if ($opMore == 0 && $opWrong == 0 && $opLeakage == 0) {
$return = array("ask" => 0, "msg" => "配货异常统计多配、错配、漏配不可一起 0 通过,如果无异常数量,请在无异常处打钩");
die(json_encode($return));
} else {
$combination = array(
"op_more" => $opMore,
"op_wrong" => $opWrong,
"op_leakage" => $opLeakage,
);
}
}
$opIdInfo = Order_Service_OrderPickup::update($combination, $opId['op_id']);
if (!$opIdInfo) {
$return = array("ask" => 0, "msg" => "配货异常统计失败");
} else {
$return = array("ask" => 1, "msg" => "配货异常统计成功");
}
}
die(json_encode($return));
}
//Html
<div id="abnormalDistributionStatisticsDialog" style="display:none" title="配货异常统计"></div>
//Js
//允许配货异常记录执行
var isShow = true;
//允许最后一次执行
var isEnd = false;
//限制仓库
var warehouseIds = ['11', '4'];
//允许关闭弹框
var isAllow = false;
//允许提示
var isOnce = true;
//最后一次执行
OrdersTotal = parseInt($('#OrdersTotal').text());
ScanOrdersTotal = parseInt($('#ScanOrdersTotal').text());
if(OrdersTotal == (ScanOrdersTotal + 1)) {
isEnd = true;
}
//弹框
if ($.inArray(json.warehouse_id, warehouseIds) != -1 && isShow == true && isEnd == true) {
statistics();
isShow = false;
}
//打包超时提示
if($.inArray(json.warehouse_id, warehouseIds) != -1 && (json.time != 0 || json.time != "") && isOnce == true) {
myVar = setInterval(packageTimeoutPrompt, json.time * 60000);
}
if(typeof myVar != "undefined") {
clearInterval(myVar);
isOnce = false;
}
//配货异常统计必填
$("#abnormalDistributionStatisticsDialog").dialog({
autoOpen: false,
modal: true,
width: 500,
height: 300,
show: "slide",
beforeclose: function () {
var op_more = $("#op_more").text();
var op_wrong = $("#op_wrong").text();
var op_leakage = $("#op_leakage").text();
var no_abnormalities = $("#no_abnormalities").text();
if (op_more == "" && op_wrong == "" && op_leakage == "" && no_abnormalities == "") {
alert('禁止进行关闭操作');
return false;
}
return true;
},
buttons: {
"提交": function () {
abnormalDistributionStatistics();
}
},
beforeclose: function () {
if (isAllow == false) {
alert('不允许进行关闭操作');
return false;
}
isAllow = true;
return true;
}
});
//配货异常统计输入框
function statistics() {
var Html = "";
Html += "<table width='100%' height='100%' border='1' style='text-align: center'>";
Html += "<tr>";
Html += "<th>多配数量</th>";
Html += "<th><input class='op_more' type='text' name='op_more' value=''></th>";
Html += "</tr>";
Html += "<tr>";
Html += "<th>错配数量</th>";
Html += "<th><input class='op_wrong' type='text' name='op_wrong' value=''></th>";
Html += "</tr>";
Html += "<tr>";
Html += "<th>漏配数量</th>";
Html += "<th><input class='op_leakage' type='text' name='op_leakage' value=''></th>";
Html += "</tr>";
Html += "<tr>";
Html += "<th>无异常</th>";
Html += "<th><input class='no_abnormalities' type='checkbox' name='no_abnormalities' value='1'></th>";
Html += "</tr>";
Html += "</table>";
$("#abnormalDistributionStatisticsDialog").html(Html);
$("#abnormalDistributionStatisticsDialog").dialog("open");
}
//配货异常统计提交
function abnormalDistributionStatistics() {
var orders_code_ch = $("#orders_code_ch").val();
var op_more = $("[name=op_more]").val();
var op_wrong = $("[name=op_wrong]").val();
var op_leakage = $("[name=op_leakage]").val();
var no_abnormalities = $("[name=no_abnormalities]:checked").attr("value");
$.ajax({
type: "post",
async: false,
dataType: "json",
url: "/warehouse/pack-check/abnormal-distribution-statistics/",
data: {
"orders_code_ch": orders_code_ch,
"op_more": op_more,
"op_wrong": op_wrong,
"op_leakage": op_leakage,
"no_abnormalities": no_abnormalities
},
success: function (json) {
if (!json.ask) {
alertTip(json.msg);
} else {
isAllow = true;
$("#abnormalDistributionStatisticsDialog").dialog("close");
if(typeof myVar != "undefined") {
clearInterval(myVar);
isOnce = false;
}
}
}
});
closeLoading();
}
//打包超时提示
function packageTimeoutPrompt() {
if(typeof myVar != "undefined") {
clearInterval(myVar);
isOnce = false;
}
$('<div title="提示"><p align="center">打包时间已超时</p></div>').dialog({
modal: true,
buttons: {
'确定': function () {
$(this).dialog("close");
}
}
});
}
错配弹框对应处理
最新推荐文章于 2019-11-29 16:45:23 发布