//Controller
//标准时间配置
public function standardTimeConfigurationAction() {
$type = $this->_request->getParam("type", "");
$warehouseId = $this->_request->getParam("userWarehouse", "");
$postName = $this->_request->getParam("post_name", "");
$trainA = $this->_request->getParam("trainA", "");
$trainB = $this->_request->getParam("trainB", "");
$trainC = $this->_request->getParam("trainC", "");
$tryHillockA = $this->_request->getParam("try_hillockA", "");
$tryHillockB = $this->_request->getParam("try_hillockB", "");
$tryHillockC = $this->_request->getParam("try_hillockC", "");
$postsA = $this->_request->getParam("postsA", "");
$postsB = $this->_request->getParam("postsB", "");
$postsC = $this->_request->getParam("postsC", "");
$matureA = $this->_request->getParam("matureA", "");
$matureB = $this->_request->getParam("matureB", "");
$matureC = $this->_request->getParam("matureC", "");
$posts = Order_Service_OrderWorkload::$post;
$return = array(
"ask" => 0,
"data" => "",
"msg" => "",
);
if (!$warehouseId) {
$return['msg'] = "请选择仓库";
} else {
if ($postName == 0) {
$configId = Common_Service_Config::getByAttribute(Order_Service_OrderWorkload::$StandardConfigurationTime['0'], $warehouseId);
$configAttribute = Order_Service_OrderWorkload::$StandardConfigurationTime['0'];
} else if ($postName == 1) {
$configId = Common_Service_Config::getByAttribute(Order_Service_OrderWorkload::$StandardConfigurationTime['1'], $warehouseId);
$configAttribute = Order_Service_OrderWorkload::$StandardConfigurationTime['1'];
} else if ($postName == 2) {
$configId = Common_Service_Config::getByAttribute(Order_Service_OrderWorkload::$StandardConfigurationTime['2'], $warehouseId);
$configAttribute = Order_Service_OrderWorkload::$StandardConfigurationTime['2'];
}
if ($type == 0) {
$return = array(
"ask" => 1,
"posts" => $posts,
);
} else if ($type == 1) {
$configValueInfo = unserialize($configId['config_value']);
$return = array(
"ask" => 1,
"data" => $configValueInfo,
);
} else {
$Info = array(
"trainA" => $trainA,
"trainB" => $trainB,
"trainC" => $trainC,
"try_hillockA" => $tryHillockA,
"try_hillockB" => $tryHillockB,
"try_hillockC" => $tryHillockC,
"postsA" => $postsA,
"postsB" => $postsB,
"postsC" => $postsC,
"matureA" => $matureA,
"matureB" => $matureB,
"matureC" => $matureC,
);
if (!$configId) {
$configInfo = array(
"config_attribute" => $configAttribute,
"warehouse_id" => $warehouseId,
"config_value" => serialize($Info),
"config_description" => "标准时间配置",
"config_create_time" => date("Y-m-d H:i:s"),
);
if (!Common_Service_Config::add($configInfo)) {
$return = array(
"ask" => 0,
"msg" => "添加失败",
);
} else {
$return = array(
"ask" => 1,
"msg" => "添加成功",
);
}
} else {
if (!Common_Service_Config::update(array("config_value" => serialize($Info)), $configId['config_id'])) {
$return = array(
"ask" => 0,
"msg" => "修改失败",
);
} else {
$return = array(
"ask" => 1,
"msg" => "修改成功",
);
}
}
die(json_encode($return));
}
}
die(json_encode($return));
}
//Html
<input class="button2" type="button" value="标准时间配置表" onclick="posts()">
<div id="timeAllocationDialog" title="标准时间配置表" style="display: none"></div>
<div id="postDialog" title="岗位选择" style="display: none"></div>
//Js
//岗位
$("#postDialog").dialog({
autoOpen: false,
modal: true,
width: 300,
show: "slide",
buttons: {
"确定": function () {
$(this).dialog("close");
timeAllocation();
},
"关闭": function () {
$(this).dialog("close");
}
}
});
//标准时间配置
$("#timeAllocationDialog").dialog({
autoOpen: false,
modal: true,
width: 700,
show: "slide",
buttons: {
"确定": function () {
timeAllocationUpdate();
},
"关闭": function () {
$(this).dialog("close");
}
}
});
//岗位
function posts() {
loading();
var userWarehouse = $("[name=userWarehouse]").val();
$.ajax({
url: "/order/order/standard-time-configuration",
async: false,
dataType: "json",
type: "post",
data: {
"type": 0,
"userWarehouse": userWarehouse
},
success: function (json) {
var Html = "";
if (json.ask == 1) {
Html += "<span>岗位:</span>";
Html += "<select name='post_name'>";
$.each(json.posts, function (key, value) {
Html += "<option value=" + key + ">" + value + "</option>";
});
Html += "</select>";
$("#postDialog").html(Html);
$("#postDialog").dialog("open");
} else {
alertTip(json.msg);
}
}
});
closeLoading();
}
//标准时间配置
function timeAllocation() {
loading();
var post_name = $("[name='post_name']").val();
var userWarehouse = $("[name=userWarehouse]").val();
$.ajax({
url: "/order/order/standard-time-configuration",
async: false,
dataType: "json",
type: "post",
data: {
"type": 1,
"post_name": post_name,
"userWarehouse": userWarehouse
},
success: function (json) {
var Html = "";
if (json.ask == 1) {
Html += "<table width='100%' height='100%' border='1' style='text-align: center'>";
Html += "<tr>";
Html += "<th>阶段</th>";
Html += "<th>时间</th>";
Html += "<th>类型</th>";
Html += "<th>标准时间(分钟)</th>";
Html += "</tr>";
if (!json.data) {
Html += "<tr>";
Html += "<td rowspan='3'>培训期</td>";
Html += "<td rowspan='3'><= 10 天</td>";
Html += "<td>A</td>";
Html += "<td><input class='item' type='text' name='trainA' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>B</td>";
Html += "<td><input class='item' type='text' name='trainB' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>C</td>";
Html += "<td><input class='item' type='text' name='trainC' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td rowspan='3'>试岗期</td>";
Html += "<td rowspan='3'>> 10 天<br/><= 20 天</td>";
Html += "<td>A</td>";
Html += "<td><input class='item' type='text' name='try_hillockA' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>B</td>";
Html += "<td><input class='item' type='text' name='try_hillockB' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>C</td>";
Html += "<td><input class='item' type='text' name='try_hillockC' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td rowspan='3'>上岗期</td>";
Html += "<td rowspan='3'>> 20 天<br/><= 30 天</td>";
Html += "<td>A</td>";
Html += "<td><input class='item' type='text' name='postsA' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>B</td>";
Html += "<td><input class='item' type='text' name='postsB' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>C</td>";
Html += "<td><input class='item' type='text' name='postsC' value=''></td>";
Html += "</tr>";
Html += "<td rowspan='3'>成熟期</td>";
Html += "<td rowspan='3'>> 30 天</td>";
Html += "<td>A</td>";
Html += "<td><input class='item' type='text' name='matureA' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>B</td>";
Html += "<td><input class='item' type='text' name='matureB' value=''></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>C</td>";
Html += "<td><input class='item' type='text' name='matureC' value=''></td>";
Html += "</tr>";
} else {
Html += "<tr>";
Html += "<td rowspan='3'>培训期</td>";
Html += "<td rowspan='3'><= 10 天</td>";
Html += "<td>A</td>";
Html += "<td><input class='item' type='text' name='trainA' value=" + json.data.trainA + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>B</td>";
Html += "<td><input class='item' type='text' name='trainB' value=" + json.data.trainB + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>C</td>";
Html += "<td><input class='item' type='text' name='trainC' value=" + json.data.trainC + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td rowspan='3'>试岗期</td>";
Html += "<td rowspan='3'>> 10 天<br/><= 20 天</td>";
Html += "<td>A</td>";
Html += "<td><input class='item' type='text' name='try_hillockA' value=" + json.data.try_hillockA + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>B</td>";
Html += "<td><input class='item' type='text' name='try_hillockB' value=" + json.data.try_hillockB + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>C</td>";
Html += "<td><input class='item' type='text' name='try_hillockC' value=" + json.data.try_hillockC + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td rowspan='3'>上岗期</td>";
Html += "<td rowspan='3'>> 20 天<br/><= 30 天</td>";
Html += "<td>A</td>";
Html += "<td><input class='item' type='text' name='postsA' value=" + json.data.postsA + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>B</td>";
Html += "<td><input class='item' type='text' name='postsB' value=" + json.data.postsB + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>C</td>";
Html += "<td><input class='item' type='text' name='postsC' value=" + json.data.postsC + "></td>";
Html += "</tr>";
Html += "<td rowspan='3'>成熟期</td>";
Html += "<td rowspan='3'>> 30 天</td>";
Html += "<td>A</td>";
Html += "<td><input class='item' type='text' name='matureA' value=" + json.data.matureA + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>B</td>";
Html += "<td><input class='item' type='text' name='matureB' value=" + json.data.matureB + "></td>";
Html += "</tr>";
Html += "<tr>";
Html += "<td>C</td>";
Html += "<td><input class='item' type='text' name='matureC' value=" + json.data.matureC + "></td>";
Html += "</tr>";
}
Html += "</table>";
$("#timeAllocationDialog").html(Html);
$("#timeAllocationDialog").dialog("open");
} else {
alertTip(json.msg);
}
}
});
closeLoading();
}
//更新标准配置时间
function timeAllocationUpdate() {
var post_name = $("[name='post_name']").val();
var userWarehouse = $("[name='userWarehouse']").val();
var trainA = $("[name='trainA']").val();
var trainB = $("[name='trainB']").val();
var trainC = $("[name='trainC']").val();
var try_hillockA = $("[name='try_hillockA']").val();
var try_hillockB = $("[name='try_hillockB']").val();
var try_hillockC = $("[name='try_hillockC']").val();
var postsA = $("[name='postsA']").val();
var postsB = $("[name='postsB']").val();
var postsC = $("[name='postsC']").val();
var matureA = $("[name='matureA']").val();
var matureB = $("[name='matureB']").val();
var matureC = $("[name='matureC']").val();
$.ajax({
url: "/order/order/standard-time-configuration",
type: "post",
dataType: "json",
async: false,
data: {
"type": 2,
"userWarehouse": userWarehouse,
"post_name": post_name,
"trainA": trainA,
"trainB": trainB,
"trainC": trainC,
"try_hillockA": try_hillockA,
"try_hillockB": try_hillockB,
"try_hillockC": try_hillockC,
"postsA": postsA,
"postsB": postsB,
"postsC": postsC,
"matureA": matureA,
"matureB": matureB,
"matureC": matureC
},
success: function (json) {
if (!json.ask) {
alertTip(json.msg);
} else {
alertTip(json.msg);
$("#timeAllocationDialog").dialog("close");
}
}
});
}
时间配置
最新推荐文章于 2023-10-10 23:22:11 发布