| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603 |
- <!doctype html>
- <html lang="en">
- <head>
- <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="0" />
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <link rel="shortcut icon" href="/img/logo.png" />
- <link rel="bookmark" href="/img/logo.png" />
- <link rel="stylesheet" href="/plugins/bootstrap-4.3.1/css/bootstrap.min.css">
- <link rel="stylesheet" href="/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
- <link href="/Plugins/bootstrap-select/css/bootstrap-select.min.css" rel="stylesheet" />
- <link rel="stylesheet" href="../common/StyleSheet.css" />
- <script src="/Plugins/jquery-3.4.1/jquery-3.4.1.min.js"></script>
- <script src="/Plugins/virtualkeyboard/xvirtualkeyboard.js"></script>
- <style type="text/css">
- .nav-link {
- padding: .4rem 0.6rem;
- }
- tr, th, td {
- height: 22px !important;
- padding: 4px !important;
- }
- </style>
- <title>东科软件</title>
- </head>
- <body class="bg-light">
- <!--导航菜单-->
- <script src="../common/navbar.js"></script>
- <!--质量登记表单-->
- <div class="container-fluid">
- <div class="row pt-2">
- <div class="col-lg-6 col-sm-12 pt-0 pb-2" style="padding-right:5px;">
- <!--产品分级-->
- <div class="rounded bg-white shadow-sm pl-4 pt-3 pr-4 pl-4 pb-2">
- <form class="pt-0">
- <div class="form-row">
- <div class="form-group col-4 mb-1">
- <label for="生产工号">生产工号</label>
- <input readonly type="text" class="form-control border-secondary" id="生产工号" placeholder="请输入" required>
- </div>
- <div class="form-group col-4 mb-1">
- <label for="产品条码">产品条码</label>
- <input value="10016153380" onkeydown="if (event.keyCode == 13) loadProduct();" type="text" class="form-control" id="产品条码" placeholder="请输入" required>
- <div id="softkeyboard"></div>
- </div>
- <div class="form-group col-4 align-self-end mb-1">
- <button onclick="loadProduct()" id="产品查询" type="button" class="btn btn-info btn-block">产品查询</button>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-4 mb-1">
- <input type="text" class="form-control border-secondary" id="产品商标" placeholder="查询" readonly>
- </div>
- <div class="form-group col-4 mb-1">
- <input type="text" class="form-control border-secondary" id="产品釉料" placeholder="查询" readonly>
- </div>
- <div class="form-group col-2 mb-1">
- <input type="text" class="form-control border-secondary" id="漏气" placeholder="查询" readonly>
- </div>
- <div class="form-group col-2 mb-1">
- <input type="text" class="form-control border-secondary" id="内漏" placeholder="查询" readonly>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-4">
- <input type="text" class="form-control border-secondary" id="产品编码" placeholder="查询" readonly>
- </div>
- <div class="form-group col-4">
- <input type="text" class="form-control border-secondary" id="产品名称" placeholder="查询" readonly>
- </div>
- <div class="form-group col-2">
- <input type="text" class="form-control border-secondary" id="重烧" placeholder="查询" readonly>
- </div>
- <div class="form-group col-2">
- <input type="text" class="form-control border-secondary" id="干补" placeholder="查询" readonly>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-4">
- <!--产品分级变量-->
- <div style="display:none;">
- <label for="产品分级">产品分级</label>
- <select id="产品分级" onchange="goodsLevel_OnChange()" class="custom-select" required disabled>
- <option value="">请选择...</option>
- </select>
- </div>
- <!--产品分级按钮-->
- <div id="产品分级按钮模板" style="display:none;">
- <label class="btn btn-info active" onclick="goodsLevelSelect('{id}')">
- <input type="radio" name="产品分级按钮项" id="产品分级{text}" value="{text}"> {text}
- </label>
- </div>
- <div id="产品分级按钮" class="btn-group btn-group-toggle pt-2" data-toggle="buttons">
- <label class="btn btn-info" onclick="goodsLevelSelect('0')">
- <input type="radio" name="产品分级按钮项" id="产品分级正品" value="正品"> 正品
- </label>
- <label class="btn btn-info" onclick="goodsLevelSelect('0')">
- <input type="radio" name="产品分级按钮项" id="产品分级副品" value="副品"> 副品
- </label>
- <label class="btn btn-info" onclick="goodsLevelSelect('0')">
- <input type="radio" name="产品分级按钮项" id="产品分级重烧" value="重烧"> 重烧
- </label>
- <label class="btn btn-info" onclick="goodsLevelSelect('0')">
- <input type="radio" name="产品分级按钮项" id="产品分级次品" value="次品"> 次品
- </label>
- </div>
- </div>
- <div class="form-group col-4">
- <label for="返工工序">返工工序</label>
- <select id="返工工序" class="custom-select" required disabled>
- <option value="">请选择...</option>
- </select>
- </div>
- <div class="form-group col-4">
- <label for="备注">备注</label>
- <input type="text" class="form-control" id="备注" placeholder="请输入" required disabled>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-12 align-self-end">
- <button onclick="productSave()" id="产品分级保存按钮" type="button" class="btn btn-danger btn-block" disabled>保存产品分级</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- <div class="col-lg-6 col-sm-12 pt-0 pb-2" style="padding-left:5px;">
- <!--产品缺陷登记-->
- <div class="rounded bg-white shadow-sm pl-4 pt-3 pr-4 pl-4 pb-2">
- <form class="pt-0">
- <div class="form-row">
- <div class="form-group col-4">
- <label for="缺陷名称">缺陷名称</label>
- <div class="input-group">
- <input type="text" class="form-control border-secondary" id="缺陷名称" placeholder="查询" readonly>
- <div class="input-group-append">
- <button class="btn btn-info" onclick="productDefect_OnClick(procedureId)" type="button" id="选择缺陷按钮" disabled>选择</button>
- </div>
- </div>
- </div>
- <div class="form-group col-4">
- <label for="缺陷位置">缺陷位置</label>
- <div class="input-group">
- <input type="text" class="form-control border-secondary" id="缺陷位置" placeholder="查询" readonly>
- <div class="input-group-append">
- <button class="btn btn-info" onclick="productDefectPosition_OnClick(procedureId)" type="button" id="选择位置按钮" disabled>选择</button>
- </div>
- </div>
- </div>
- <div class="form-group col-4">
- <label for="特殊缺陷">特殊缺陷</label>
- <select id="特殊缺陷" class="custom-select" required disabled>
- <option value="" selected>请选择...</option>
- <option value="1">1</option>
- <option value="0">0</option>
- </select>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-4">
- <label for="责任工序">责任工序</label>
- <select onchange="defectProcedure_OnChange()" id="责任工序" class="custom-select" required disabled>
- <option value="">请选择...</option>
- </select>
- </div>
- <div class="form-group col-4">
- <label for="责任工号">责任工号</label>
- <div class="input-group">
- <input type="text" onkeyup="this.value=this.value.toUpperCase()" onkeydown="if (event.keyCode == 13) loadDefectByUserCode(procedureId);" class="form-control border-secondary" id="责任工号" placeholder="请输入..." disabled>
- <div class="input-group-append">
- <button class="btn btn-info" onclick="loadDefectByUserCode(procedureId)" type="button" id="责任工号按钮" disabled>查询</button>
- </div>
- </div>
- </div>
- <div class="form-group col-4">
- <label for="责任工种">责任工种</label>
- <select id="责任工种" class="custom-select" onchange="defectJobs_OnChange()" required disabled>
- <option value="">请选择...</option>
- </select>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-4">
- <label for="责任人">责任人</label>
- <select id="责任人" class="form-control selectpicker" title="请选择..." multiple required disabled>
- <option value="">请选择...</option>
- </select>
- </div>
- <div class="form-group col-4">
- <label for="缺陷扣罚">缺陷扣罚</label>
- <select id="缺陷扣罚" class="custom-select" required disabled>
- <option value="">请选择...</option>
- </select>
- </div>
- <div class="form-group col-4">
- <label for="扣除数">扣除数</label>
- <select id="扣除数" class="custom-select" required disabled>
- <option value="">请选择...</option>
- </select>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-6 align-self-end">
- <button onclick="productDefectSaveOne()" id="产品缺陷保存按钮" type="button" class="btn btn-secondary btn-block" disabled>保存缺陷记录(单次)</button>
- </div>
- <div class="form-group col-6 align-self-end">
- <button onclick="productDefectSaveMore()" id="产品缺陷保存按钮多次" type="button" class="btn btn-warning btn-block" disabled>保存缺陷记录(多次)</button>
- </div>
- </div>
- <div class="form-row">
- </div>
- </form>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-12 pt-0 pb-0">
- <!--产品缺陷记录登记-->
- <div class="rounded bg-white shadow-sm pl-4 pr-4 pt-4 pb-2">
- <table class="table table-bordered">
- <thead>
- <tr>
- <th>缺陷名称</th>
- <th>缺陷位置</th>
- <th>责任工序</th>
- <th>工号</th>
- <th>工种</th>
- <th>责任人</th>
- <th>扣罚</th>
- <th>扣除</th>
- <th>特殊</th>
- <th> </th>
- </tr>
- </thead>
- <tbody id="产品缺陷列表">
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <!--缺陷列表模板-->
- <div class="d-none">
- <table>
- <tbody id="缺陷列表模板">
- <tr id="{缺陷标识}">
- <td>{缺陷编码}{缺陷名称}</td>
- <td>{位置编码}{缺陷位置}</td>
- <td>{责任工序}</td>
- <td>{责任工号}</td>
- <td>{责任工种}</td>
- <td>{责任人}</td>
- <td>{缺陷扣罚}</td>
- <td>{扣除数}</td>
- <td>{特殊缺陷}</td>
- <td><button delbutton="true" onclick="productDefectDelete('{缺陷标识}')" class="btn btn-sm btn-block btn-danger" type="button">删除</button></td>
- </tr>
- </tbody>
- </table>
- </div>
- <!--对话框-->
- <script src="../common/dialog.js"></script>
- <!--产品缺陷对话框-->
- <script src="../common/dialogDefect.js"></script>
- <!--产品缺陷位置对话框-->
- <script src="../common/dialogDefectPosition.js"></script>
- <!--版权信息-->
- <script src="../common/footer.js"></script>
- <script src="/Plugins/bootstrap-4.3.1/js/bootstrap.bundle.min.js"></script>
- <script src="/Plugins/bootstrap-select/js/bootstrap-select.min.js"></script>
- <script src="/Plugins/sweetalert/sweetalert.min.js"></script>
- <script src="/Plugins/xrequest/xrequest.min.js"></script>
- <script src="../Common/xuwell.js"></script>
- <script>
- //xuwei 2020-04-21
- //计件标记变量 1新建 2改判 3冷补后
- var checkFlag = '1';
- //是否打印条码
- var printBarcode = false;
- //成检工序ID
- var procedureId = request('id');
- //接口数据源定义
- var completeProcedure;
- var jsonUser;
- var jsonGoodsLevel;
- var jsonProcedure;
- var jsonStaff;
- var defectUserId;
- var jsonProductData;
- //操作方式 insert update
- var action = "";
- //用于提交的缺陷数据
- var productionDefects = [];
- //用于显示的缺陷数据
- var defectJson = [];
- var defectCount = 0;
- var userId = "";
- $(document).ready(function () {
- //读取是否打印条码
- //$.get('print/getprint.ashx', function (d) {
- // var p = JSON.parse(d);
- // printBarcode = p['success']
- //});
- //加载数据
- loadData();
- });
- //产品分级按钮事件
- function goodsLevelSelect(value) {
- $("#产品分级").val(value);
- goodsLevel_OnChange();
- }
- function keyBoard() {
- //加载软键盘
- $('#产品条码').keyboard({ usePreview: false, autoAccept: true });
- $('#备注').keyboard({ usePreview: false, autoAccept: true });
- $('#责任工号').keyboard({ usePreview: false, autoAccept: true });
- swal({
- title: '产品分级',
- text: '软键盘已加载!',
- icon: 'success',
- button: '确定'
- });
- }
- //加载 生产工号
- function loadData() {
- //检查登录状态
- $.get('api/LogInCheck_WCF.ashx', function (data) {
- var json = JSON.parse(data);
- if (json["success"] == true) {
- //登录状态
- $('#生产工号').val(json["rows"]["userCode"]);
- //保存登录数据源
- jsonUser = json["rows"];
- }
- else {
- swal({
- title: '登录异常!',
- text: '请您先登录系统!',
- icon: 'error',
- button: '确定'
- }).then(function () {
- window.location = '/main/login/login.html';
- });
- }
- });
- ClearProductDefectList();
- }
- //清空 产品缺陷列表 位置
- function ClearProductDefectList() {
- $('#产品缺陷列表').html('<tr><td colspan="9" style="text-align:center">暂无产品缺陷数据。<td></tr>');
- defectJson = [];
- productionDefects = [];
- defectCount = 0;
- }
- //输入条码 加载 产品信息
- function loadProduct() {
- swal({
- title: '产品分级',
- text: '正在查询数据,请稍候。。。',
- icon: 'info',
- button: false,
- closeOnClickOutside: false
- });
- //重置缺陷数据
- productionDefects = [];
- defectJson = [];
- defectCount = 0;
- $("[delbutton='true']").prop("disabled", false);
- procedureId = request('id');
- //加载产品信息
- $.get('api/GetCheckBarCode_WCF.ashx', { 'procedureid': procedureId, 'barcode': $('#产品条码').val() }, function (data) {
- var json = JSON.parse(data);
- if (json['success'] == true) {
- //打印条码
- //if (printBarcode) $('#barcodeImg').attr('src', 'print/barcodeimg.ashx?barcode=' + $('#产品条码').val());
- if (json['rows'][0]['out_errMsg'] == '') {
- //读取产品信息
- $('#产品商标').val('商标:' + json['rows'][0]["out_logoName"]);
- $('#产品釉料').val('釉料:' + json['rows'][0]["out_glazeName"]);
- $('#产品编码').val('编码:' + json['rows'][0]["out_goodsCode"]);
- $('#产品名称').val('名称:' + json['rows'][0]["out_goodsName"]);
- $('#漏气').val('漏气:' + json['rows'][0]["out_LeakFlag1"]);
- $('#内漏').val('内漏:' + json['rows'][0]["out_LeakFlag2"]);
- //设置漏气内漏样式 1合格0不合格
- $('#漏气').removeClass('bg-info,bg-warning');
- $('#内漏').removeClass('bg-info,bg-warning');
- if (json['rows'][0]["out_LeakFlag1"] == "1") $('#漏气').addClass('bg-info');
- if (json['rows'][0]["out_LeakFlag1"] == "0") $('#漏气').addClass('bg-warning');
- if (json['rows'][0]["out_LeakFlag2"] == "1") $('#内漏').addClass('bg-info');
- if (json['rows'][0]["out_LeakFlag2"] == "0") $('#内漏').addClass('bg-warning');
- $('#重烧').val('重烧:' + json['rows'][0]["out_isReFire"]);
- $('#干补').val('干补:' + json['rows'][0]["out_specialRepairFlag"]);
- //加载完成工序 判断 是 新建 还是 编辑
- $.get('api/GetCompleteProcedureIDPDA_WCF.ashx', { 'barcode': $('#产品条码').val() }, function (data) {
- var json = JSON.parse(data);
- if (json["success"] == true) {
- swal.close();
- completeProcedure = json["rows"];
- if (procedureId == completeProcedure[0]["COMPLETEPROCEDUREID"]) {
- checkFlag = "2";
- action = "update";
- loadUpdateData(0);
- }
- else {
- //2020-03-23 修正 回收后 再次成检 改判操作 找到正确的成检ID
- $.get('api/GetProductionDataCheckID_WCF.ashx', { 'barcode': $('#产品条码').val() }, function (data) {
- if (data == '{"success":true,"message":"操作成功!","rows":}') {
- data = '{"success":true,"message":"操作成功!","rows":""}';
- }
- var json = JSON.parse(data);
- if (json["success"] == true) {
- //2020-04-23 xuwei 修正
- if (json["rows"].length == 0) {
- //为空行时是新建
- checkFlag = "1";
- action = "insert";
- loadInsertData();
- }
- else {
- if (json["rows"][0]["PROCEDUREID"] == procedureId) {
- //工序相等时是更新
- checkFlag = "3";
- action = "update";
- loadUpdateData(json["rows"][0]["PRODUCTIONDATAID"]);
- }
- else {
- //工序不等时不可到达
- resetGoodsGrade(false);
- swal({
- title: "产品查询",
- text: "该工序不可到达!请确认质量登记工序!",
- icon: "error",
- button: "确定"
- }).then(function () {
- $('#产品条码').val('');
- $('#产品条码').focus();
- });
- }
- }
- //if (json["rows"][0]["PRODUCTIONDATAID"] != 0) {
- // checkFlag = "3";
- // action = "update";
- // loadUpdateData(json["rows"][0]["PRODUCTIONDATAID"]);
- //}
- //else {
- // checkFlag = "1";
- // action = "insert";
- // loadInsertData();
- //}
- }
- });
- }
- }
- });
- }
- else {
- resetGoodsGrade(false);
- swal({
- title: "产品查询",
- text: json['rows'][0]['out_errMsg'],
- icon: "error",
- button: "确定"
- }).then(function () {
- //条码无效时清空条码 2020-03-03 xuwei
- $('#产品条码').val('');
- $('#产品条码').focus();
- });
- }
- }
- else {
- swal({
- title: '登录异常!',
- text: '请您重新登录系统!',
- icon: 'error',
- button: '确定'
- }).then(function () {
- window.location = '/main/login/login.html';
- });
- }
- //产品缺陷列表清空
- ClearProductDefectList();
- });
- }
- //加载插入数据
- function loadInsertData() {
- //从预检(直接取在产表 tp_pm_inproduction)加载数据 xuwei add 2020-06-11 ======
- $.get('api/GetPreProductCheck.ashx?barCode=' + $('#产品条码').val(), function (data) {
- json = JSON.parse(data);
- var goodsLevelTypeId = 0;
- var reworkProcedureId = 0;
- if (json["success"] == true) {
- if (json["rows"].length > 0) {
- goodsLevelTypeId = json["rows"][0]["GOODSLEVELTYPEID"];
- reworkProcedureId = json["rows"][0]["REWORKPROCEDUREID"];
- }
- }
- //加载产品分级
- xuwell.loadSelect({
- id: '#产品分级',
- url: 'api/GetProductCheckGoodsGrade_WCF.ashx',
- data: {},
- fieldKey: 'DEFECTFLAGID',
- fieldValue: 'DEFECTFLAGNAME',
- onLoad: function (data) {
- $('#产品分级').get(0).selectedIndex = 0;
- if (goodsLevelTypeId > 0) $('#产品分级').val(goodsLevelTypeId);
- jsonGoodsLevel = data["rows"];
- //更新按钮状态
- goodsLevel_OnChange();
- //加载产品分级按钮
- if ($('#产品分级按钮').length > 0) {
- $('#产品分级按钮').html('');
- for (var i = 0; i < jsonGoodsLevel.length; i++) {
- var temp = $('#产品分级按钮模板').html().replaceAll('{id}', data["rows"][i]["DEFECTFLAGID"]).replaceAll('{text}', data["rows"][i]["DEFECTFLAGNAME"]);
- if (data["rows"][i]["DEFECTFLAGID"] != goodsLevelTypeId)
- temp = temp.replaceAll('active', '');
- $('#产品分级按钮').append(temp);
- }
- }
- }
- });
- //加载产品返工工序
- xuwell.loadSelect({
- id: '#返工工序',
- url: 'api/GetProductCheckReworkProcedure_WCF.ashx',
- data: { 'id': procedureId },
- fieldKey: 'REWORKPROCEDUREID',
- fieldValue: 'REWORKPROCEDURENAME',
- onLoad: function () {
- $('#返工工序').get(0).selectedIndex = 0;
- if (reworkProcedureId > 0) $('#返工工序').val(reworkProcedureId);
- }
- });
- //备注可用
- $('#产品分级').val('');
- $('#备注').prop('disabled', false);
- });
- //=============================================================================
- }
- //加载编辑数据
- function loadUpdateData(productionDataCheckID) {
- if (action == "update") {
- //读取产品编辑ID
- $.get('api/GetProductionData_WCF.ashx', { 'BarCode': $('#产品条码').val(), 'ProcedureID': procedureId, 'userCode': $('#生产工号').val() }, function (data) {
- var json = JSON.parse(data);
- if (json["success"] == true) {
- //记录成检数据ID
- if (json["rows"].toString() != "") productionDataID = json["rows"][0]["PRODUCTIONDATAID"];
- //xuwei add 2020-03-23 回收后成检数据ID变更
- if (productionDataCheckID != 0) productionDataID = productionDataCheckID;
- //读取成检数据
- $.get('api/GetProductionDataByID_WCF.ashx', { 'productionDataID': productionDataID }, function (data) {
- swal.close();
- var json = JSON.parse(data);
- //读取产品信息 xuwei add 2020-03-23
- $('#产品商标').val('商标:' + json["rows"]["PDAProductionData"][0]["LogoName"]);
- $('#产品釉料').val('釉料:' + json["rows"]["PDAProductionData"][0]["GlazeName"]);
- $('#产品编码').val('编码:' + json["rows"]["PDAProductionData"][0]["GoodsCode"]);
- $('#产品名称').val('名称:' + json["rows"]["PDAProductionData"][0]["GoodsName"]);
- $('#重烧').val('重烧:' + json["rows"]["PDAProductionData"][0]["IsReFire"]);
- $('#干补').val('干补:' + json["rows"]["PDAProductionData"][0]["SpecialRepairflag"]);
- if (json["success"] == true) {
- //加载产品分级
- xuwell.loadSelect({
- id: '#产品分级',
- url: 'api/GetProductCheckGoodsGrade_WCF.ashx',
- data: {},
- fieldKey: 'DEFECTFLAGID',
- fieldValue: 'DEFECTFLAGNAME',
- onLoad: function (data) {
- $('#产品分级').val(json["rows"]["PDAProductionData"][0]["DefectFlagID"]);
- jsonGoodsLevel = data["rows"];
- //加载产品分级按钮
- if ($('#产品分级按钮').length > 0) {
- $('#产品分级按钮').html('');
- for (var i = 0; i < jsonGoodsLevel.length; i++) {
- var temp = $('#产品分级按钮模板').html().replaceAll('{id}', data["rows"][i]["DEFECTFLAGID"]).replaceAll('{text}', data["rows"][i]["DEFECTFLAGNAME"]);
- if (data["rows"][i]["DEFECTFLAGID"] != json["rows"]["PDAProductionData"][0]["DefectFlagID"])
- temp = temp.replaceAll('active', '');
- $('#产品分级按钮').append(temp);
- }
- }
- //判定是否超过改判时间
- $.get('api/GetSystemSettingDataByCode_WCF.ashx', function (data) {
- var json = JSON.parse(data);
- if (json["success"] == true) {
- var value = json["rows"][0]["SETTINGVALUE"];
- //判断是否超过改判时间
- //正常 value=0 是不限制 但是按PDA逻辑 使用接口再进行判定
- var createTime = jsonProductData["CreateTime"];
- $.post('api/BarcodeAllowCancel_WCF.ashx', { 'orgTime': createTime, 'days': value }, function (data) {
- var json = JSON.parse(data);
- if (json["success"] == true) {
- //更新按钮状态
- goodsLevel_OnChange();
- $('#产品分级保存按钮').prop('disabled', false);
- $('#备注').prop('disabled', false);
- }
- else {
- $('#产品分级').prop("disabled", true);
- $("[delbutton='true']").prop("disabled", true);
- swal({
- title: "产品分级",
- text: "产品已过系统改判时间!",
- icon: "warning",
- button: "确定"
- });
- }
- });
- }
- });
- }
- });
- //加载产品返工工序
- xuwell.loadSelect({
- id: '#返工工序',
- url: 'api/GetProductCheckReworkProcedure_WCF.ashx',
- data: { 'id': procedureId },
- fieldKey: 'REWORKPROCEDUREID',
- fieldValue: 'REWORKPROCEDURENAME',
- autoDisabled: false,
- onLoad: function () {
- $('#返工工序').val(json["rows"]["PDAProductionData"][0]["ReworkProcedureID"]);
- }
- });
- //加载分级数据
- $('#备注').val(json["rows"]["PDAProductionData"][0]["Remarks"]);
- //记录修改数据
- jsonProductData = json["rows"]["PDAProductionData"][0];
- //加载缺陷数据
- var defect = json["rows"]["PDAProductionData"][0]["PDADefects"];
- for (var i = 0; i < defect.length; i++) {
- //更新数据模板并添加记录
- var temp = $('#缺陷列表模板').html();
- if (i == 0) $('#产品缺陷列表').empty();
- temp = temp.replaceAll('{缺陷标识}', i);
- temp = temp.replaceAll('{缺陷编码}', defect[i]["DefectCode"]);
- temp = temp.replaceAll('{缺陷名称}', defect[i]["DefectName"]);
- temp = temp.replaceAll('{位置编码}', defect[i]["DefectPositionCode"]);
- temp = temp.replaceAll('{缺陷位置}', defect[i]["DefectPositionName"]);
- temp = temp.replaceAll('{责任工序}', defect[i]["DefectProcedureName"]);
- temp = temp.replaceAll('{责任工号}', defect[i]["DefectUserCode"]);
- temp = temp.replaceAll('{责任工种}', defect[i]["Jobs"] + defect[i]["JobsText"]);
- temp = temp.replaceAll('{责任人}', getDefectUserNameFromDefect(defect[i]));
- temp = temp.replaceAll('{缺陷扣罚}', defect[i]["DefectFineValue"]);
- temp = temp.replaceAll('{扣除数}', defect[i]["DefectDeductionNum"]);
- temp = temp.replaceAll('{特殊缺陷}', defect[i]["SpecialDefect"]);
- $('#产品缺陷列表').append(temp);
- //加载缺陷数据用于提交
- productDefectLoadJson(defect[i]);
- }
- }
- });
- }
- });
- }
- }
- //产品分级 改变连动处理
- function goodsLevel_OnChange() {
- if ($("#产品分级").val() != '') {
- //重烧能选择返工工序
- if ($("#产品分级").find("option:selected").text() == '重烧') {
- $('#返工工序').prop('disabled', false);
- $('#返工工序').get(0).selectedIndex = 1;
- }
- else {
- $('#返工工序').prop('disabled', true);
- $("#返工工序").val('');
- }
- //缺陷页控制
- if ($("#产品分级").find("option:selected").text() == '正品') {
- //如果有缺陷记录要确认是否删除
- if (productionDefects.length > 0) {
- swal({
- title: "产品分级",
- text: "产品分级改判为正品,必须除缺陷记录!",
- icon: "warning",
- buttons: true,
- dangerMode: true,
- buttons: ["取消", "删除缺陷记录"]
- }).then((ok) => {
- if (ok) {
- $("#返工工序").val('');
- $('#返工工序').prop('disabled', true);
- //产品缺陷列表清空
- ClearProductDefectList();
- resetSaveButton();
- }
- });
- }
- else {
- //产品缺陷列表清空
- ClearProductDefectList();
- }
- }
- else {
- $('#产品分级保存按钮').prop('disabled', true);
- }
- //更新保存按钮
- resetSaveButton();
- }
- else {
- $('#产品分级保存按钮').prop('disabled', true);
- }
- }
- //启用禁用 产品分级 保存按钮
- function resetSaveButton() {
- //保存按钮控制 正品没有缺陷记录可保存,非正品必须有缺陷记录才可保存
- if ($("#产品分级").find("option:selected").text() == '正品') {
- if (productionDefects.length == 0)
- $('#产品分级保存按钮').prop('disabled', false);
- else
- $('#产品分级保存按钮').prop('disabled', true);
- //重置产品缺陷选择
- resetProductDefect(true);
- }
- else {
- if (productionDefects.length > 0)
- $('#产品分级保存按钮').prop('disabled', false);
- else
- $('#产品分级保存按钮').prop('disabled', true);
- //重置产品缺陷选择
- resetProductDefect(false);
- }
- }
- //启用禁用 产品分级 页
- function resetGoodsGrade(clearBarCode) {
- //产品信息清空
- $('#产品商标').val('');
- $('#产品釉料').val('');
- $('#产品编码').val('');
- $('#产品名称').val('');
- $('#重烧').val('');
- $('#干补').val('');
- //产品分级选项清空禁用
- $('#产品分级').val('');
- $('#产品分级').prop('disabled', true);
- $('#返工工序').val('');
- $('#返工工序').prop('disabled', true);
- $('#备注').val('');
- $('#备注').prop('disabled', true);
- $('#产品分级保存按钮').prop('disabled', true);
- //产品缺陷禁用
- resetProductDefect(true);
- if (clearBarCode) $('#产品条码').val('');
- $('#产品条码').focus();
- }
- //启用禁用 产品缺陷 页
- function resetProductDefect(disabled) {
- if (disabled) {
- $('#缺陷名称').val('');
- $('#选择缺陷按钮').prop('disabled', true);
- $('#缺陷位置').val('');
- $('#选择位置按钮').prop('disabled', true);
- $('#特殊缺陷').val('');
- $('#特殊缺陷').prop('disabled', true);
- $('#责任工序').val('');
- $('#责任工序').prop('disabled', true);
- $('#责任工号').val('');
- $('#责任工号').prop('disabled', true);
- $('#责任工号按钮').prop('disabled', true);
- $('#责任工种').val('');
- $('#责任工种').prop('disabled', true);
- $('#责任人').val('');
- $('#责任人').prop('disabled', true);
- $('#责任人').selectpicker('refresh');
- $('#缺陷扣罚').val('');
- $('#缺陷扣罚').prop('disabled', true);
- $('#扣除数').val('');
- $('#扣除数').prop('disabled', true);
- $('#产品缺陷保存按钮').prop('disabled', true);
- $('#产品缺陷保存按钮多次').prop('disabled', true);
- }
- else {
- $('#缺陷名称').val('');
- $('#选择缺陷按钮').prop('disabled', false);
- $('#缺陷位置').val('');
- $('#选择位置按钮').prop('disabled', false);
- $('#特殊缺陷').val('');
- //$('#特殊缺陷').prop('disabled', false);
- $('#责任工序').val('');
- //$('#责任工序').prop('disabled', false);
- $('#责任工号').val('');
- //$('#责任工号').prop('disabled', false);
- //$('#责任工号按钮').prop('disabled', false);
- $('#责任工种').val('');
- //$('#责任工种').prop('disabled', false);
- $('#责任人').val('');
- //$('#责任人').prop('disabled', false);
- $('#责任人').selectpicker('refresh');
- $('#缺陷扣罚').val('');
- //$('#缺陷扣罚').prop('disabled', false);
- $('#扣除数').val('');
- //$('#扣除数').prop('disabled', false);
- $('#产品缺陷保存按钮').prop('disabled', true);
- $('#产品缺陷保存按钮多次').prop('disabled', true);
- }
- //中陶 只有一个缺陷位置 默认选中第一项=================
- if (productDefectPositionData['rows'].length > 0) {
- productDefectPositionId = productDefectPositionData['rows'][0]['DEFECTPOSITIONID'];
- productDefectPositionCode = productDefectPositionData['rows'][0]['DEFECTPOSITIONCODE'];
- productDefectPositionName = productDefectPositionData['rows'][0]['DEFECTPOSITIONNAME'];
- $('#缺陷位置').val(productDefectPositionName);
- }
- //=======================================================
- }
- //加载 责任工序
- function loadDefectProcedure() {
- //加载责任工序
- xuwell.loadSelect({
- id: '#责任工序',
- url: 'api/GetDutyProcedureByBarCode_WCF.ashx',
- data: {
- 'barcode': $('#产品条码').val(),
- 'defectid': productDefectId
- },
- fieldKey: 'DUTYPROCEDUREID',
- fieldValue: 'DUTYPROCEDURENAME',
- onLoad: function (data) {
- jsonProcedure = data['rows'];
- }
- });
- //加载缺限扣罚
- xuwell.loadSelect({
- id: '#缺陷扣罚',
- //url: 'api/GetAllDefectFine_WCF.ashx',
- url: 'api/GetDefectFine.ashx',
- data: { 'defectid': productDefectId },
- fieldKey: 'DEFECTFINEID',
- fieldValue: 'DEFECTFINECODE',
- onLoad: function () {
- $('#缺陷扣罚').get(0).selectedIndex = 1;
- }
- });
- //加载扣除数
- xuwell.loadSelect({
- id: '#扣除数',
- //url: 'api/GetAllDefectDeduction_WCF.ashx',
- url: 'api/GetDefectDeduction.ashx',
- data: { 'defectid': productDefectId },
- fieldKey: 'DEFECTDEDUCTIONID',
- fieldValue: 'DEFECTDEDUCTIONNUM',
- onLoad: function () {
- $('#扣除数').get(0).selectedIndex = 1;
- }
- });
- $('#特殊缺陷').val('0');
- $('#特殊缺陷').prop('disabled', false);
- $('#责任工号按钮').prop('disabled', false);
- $('#责任工号').prop('disabled', false);
- $('#责任工号').val('');
- $('#责任工种').prop('disabled', true);
- $('#责任工种').val('');
- $('#责任人').prop('disabled', true);
- $('#责任人').val('');
- }
- //责任工序 改变连动处理
- function defectProcedure_OnChange() {
- var selectIndex = $('#责任工序').prop("selectedIndex");
- if (selectIndex > 0) {
- //加载责任工号
- $('#责任工号按钮').prop('disabled', true);
- $('#责任工号').prop('disabled', true);
- $('#责任工号').val(jsonProcedure[selectIndex - 1]['USERCODE']);
- defectUserId = jsonProcedure[selectIndex - 1]['USERID'];
- //加载责任工种
- xuwell.loadSelect({
- id: '#责任工种',
- url: 'api/GetDutyJobsByUserIDAndProductionID_WCF.ashx',
- data: {
- 'classesSettingID': jsonProcedure[selectIndex - 1]['CLASSESSETTINGID'],
- 'defectid': productDefectId,
- 'procedureID': jsonProcedure[selectIndex - 1]['DUTYPROCEDUREID']
- },
- fieldKey: 'JOBSID',
- fieldValue: 'JOBSNAME',
- onLoad: function (data) {
- $('#责任工种').get(0).selectedIndex = 1;
- }
- });
- //加载责任人
- xuwell.loadSelect({
- id: '#责任人',
- url: 'api/GetDutyStaffByUserIDAndJobs_WCF.ashx',
- data: {
- 'classesSettingID': jsonProcedure[selectIndex - 1]['CLASSESSETTINGID'],
- 'jobsid': jsonProcedure[selectIndex - 1]['JOBSID']
- },
- fieldKey: 'STAFFID',
- fieldValue: 'STAFFNAME',
- addTitle: false,
- onLoad: function (data) {
- jsonStaff = data["rows"];
- //$('#责任人').get(0).selectedIndex = '1,2';
- $("#责任人").selectpicker({
- selectedTextFormat: 'values',
- });
- $('#责任人').selectpicker('refresh');
- $('#责任人').selectpicker('selectAll');
- }
- });
- }
- else {
- $('#责任工号按钮').prop('disabled', false);
- $('#责任工号').prop('disabled', false);
- $('#责任工号').val('');
- $('#责任工种').prop('disabled', true);
- $('#责任工种').val('');
- $('#责任人').prop('disabled', true);
- //$('#责任人').val('');
- $('#责任人').selectpicker('val', []);
- }
- }
- //加载 责任工种 从 责任工号(无责任)
- function loadDefectByUserCode() {
- //查找userId
- $.get('api/GetUserCode_WCF.ashx', { 'usercode': $('#责任工号').val() }, function (data) {
- var json = JSON.parse(data);
- if (json['success'] == true && json['rows'].length > 0) {
- userId = json['rows'][0]['USERID'];
- defectUserId = json['rows'][0]['USERID'];
- //加载责任工种
- xuwell.loadSelect({
- id: '#责任工种',
- url: 'api/GetAllJobsByUserID_WCF.ashx',
- data: { 'userid': userId },
- fieldKey: 'JOBS',
- fieldValue: 'JOBSNAME',
- onLoad: function (data) {
- $('#责任工种').get(0).selectedIndex = 1;
- //加载责任人
- defectJobs_OnChange();
- }
- });
- }
- else {
- swal({
- title: "工号查询",
- text: "工号不正确!",
- icon: "error",
- button: "确定"
- });
- }
- });
- }
- //责任工种 改变连动处理
- function defectJobs_OnChange() {
- //没有选择责任工序 通过责任工种 查找 责任人
- if ($('#责任工序').val() == '') {
- //加载责任人
- if ($('#责任工种').val() != '') {
- xuwell.loadSelect({
- id: '#责任人',
- url: 'api/GetDutyStaffByUserJobsID_WCF.ashx',
- data: {
- 'userid': userId,
- 'jobs': $('#责任工种').val()
- },
- fieldKey: 'STAFFID',
- fieldValue: 'STAFFNAME',
- addTitle: false,
- onLoad: function (data) {
- jsonStaff = data["rows"];
- //$('#责任人').get(0).selectedIndex = 1;
- $('#责任人').selectpicker('refresh');
- $('#责任人').selectpicker('selectAll');
- },
- onError: function () {
- $('#责任人').val('');
- $('#责任人').prop('disabled', true);
- $('#责任人').selectpicker('refresh');
- }
- });
- }
- else {
- $('#责任人').val('');
- $('#责任人').prop('disabled', true);
- $('#责任人').selectpicker('refresh');
- }
- }
- }
- //单次保存
- function productDefectSaveOne() {
- if (productDefectSave()) {
- //重设缺陷编辑状态 可继续添加缺陷
- resetProductDefect(true);
- //$('#缺陷名称').val('');
- $('#选择缺陷按钮').prop('disabled', false);
- //$('#缺陷位置').val('');
- $('#选择位置按钮').prop('disabled', false);
- //更新产品分级保存按钮
- $('#产品分级保存按钮').prop('disabled', false);
- }
- }
- //多次保存
- function productDefectSaveMore() {
- if (productDefectSave()) {
- $('#责任工序').val('');
- defectProcedure_OnChange();
- //更新产品分级保存按钮
- $('#产品分级保存按钮').prop('disabled', false);
- }
- }
- //保存产品缺陷记录处理
- function productDefectSave() {
- //校验填写数据
- if ($('#缺陷名称').val() == '') {
- swal({
- title: "产品缺陷",
- text: '请您选择缺陷名称!',
- icon: "error",
- button: "确定"
- });
- return false;
- }
- if ($('#缺陷位置').val() == '') {
- swal({
- title: "产品缺陷",
- text: '请您选择缺陷位置!',
- icon: "error",
- button: "确定"
- });
- return false;
- }
- if ($('#责任工序').val() == '' && $('#责任工号').val() == '') {
- swal({
- title: "产品缺陷",
- text: '请您选择责任工序或者填写责任工号!',
- icon: "error",
- button: "确定"
- });
- return false;
- }
- if ($('#责任工种').val() == '') {
- swal({
- title: "产品缺陷",
- text: '请您选择责任工种!',
- icon: "error",
- button: "确定"
- });
- return false;
- }
- if ($('#责任人').val() == '') {
- swal({
- title: "产品缺陷",
- text: '请您选择责任人!',
- icon: "error",
- button: "确定"
- });
- return false;
- }
- if ($('#缺陷扣罚').val() == '') {
- swal({
- title: "产品缺陷",
- text: '请您选择缺陷扣罚!',
- icon: "error",
- button: "确定"
- });
- return false;
- }
- if ($('#扣除数').val() == '') {
- swal({
- title: "产品缺陷",
- text: '请您选择扣除数!',
- icon: "error",
- button: "确定"
- });
- return false;
- }
- if ($('#特殊缺陷').val() == '') {
- swal({
- title: "产品缺陷",
- text: '请您选择特殊缺陷!',
- icon: "error",
- button: "确定"
- });
- return false;
- }
- //判断缺陷是否重复 2020-04-24
- for (var i = 0; i < productionDefects.length; i++) {
- if (
- productionDefects[i]["DefectID"] == productDefectId
- && productionDefects[i]["DefectProcedureID"] == ($('#责任工序').val() == "" ? null : $('#责任工序').val())
- && productionDefects[i]["DefectUserCode"] == $("#责任工号").val()
- ) {
- swal({
- title: "产品缺陷",
- text: '缺陷重复,不允许添加!',
- icon: "error",
- button: "确定"
- });
- return false;
- }
- }
- //更新数据模板并添加记录
- var temp = $('#缺陷列表模板').html();
- if (defectCount == 0) $('#产品缺陷列表').empty();
- temp = temp.replaceAll('{缺陷标识}', defectCount);
- temp = temp.replaceAll('{缺陷编码}', productDefectCode);
- temp = temp.replaceAll('{缺陷名称}', $('#缺陷名称').val());
- temp = temp.replaceAll('{位置编码}', productDefectPositionCode);
- temp = temp.replaceAll('{缺陷位置}', $('#缺陷位置').val());
- temp = temp.replaceAll('{责任工序}', $("#责任工序").val() == '' ? '' : $("#责任工序").find("option:selected").text());
- temp = temp.replaceAll('{责任工号}', $('#责任工号').val());
- temp = temp.replaceAll('{责任工种}', $('#责任工种').val() + $('#责任工种').find("option:selected").text());
- temp = temp.replaceAll('{责任人}', getDefectUserName());
- temp = temp.replaceAll('{缺陷扣罚}', $('#缺陷扣罚').find("option:selected").text());
- temp = temp.replaceAll('{扣除数}', $('#扣除数').find("option:selected").text());
- temp = temp.replaceAll('{特殊缺陷}', $('#特殊缺陷').find("option:selected").text());
- $('#产品缺陷列表').append(temp);
- //保存缺陷数据
- productDefectSaveJson();
- return true;
- }
- //保存产品缺陷记录拼合处理
- function productDefectSaveJson() {
- //定义缺陷责任
- var defectResponsibles = [];
- //获取责任人
- console.log($("#责任人").selectpicker('val'));
- console.log(jsonStaff);
- for (var i = 0; i < jsonStaff.length; i++) {
- if ($("#责任人").selectpicker('val').indexOf(jsonStaff[i]["STAFFID"].toString()) >= 0) {
- var defectOne = {
- "UserID": defectUserId,
- "UserCode": $("#责任工号").val(),
- "SJobsID": jsonStaff[i]["SJOBSID"],
- "StaffStatus": jsonStaff[i]["STAFFSTATUS"],
- "StaffID": jsonStaff[i]["STAFFID"],
- "UJobsID": $("#责任工种").val()
- }
- //如果是更新
- if (action == "update") {
- if (jsonProductData["PDADefects"].length > 0)
- defectOne["PDACheckTime"] = jsonProductData["PDADefects"][0]["CheckTime"];
- }
- defectResponsibles.push(defectOne);
- }
- }
- //定义缺陷数据
- var productionOne = {
- "DefectID": productDefectId,
- "DefectCode": productDefectCode,
- "DefectName": productDefectName,
- "DefectPositionID": productDefectPositionId,
- "DefectPositionCode": productDefectPositionCode,
- "DefectPositionName": productDefectPositionName,
- "DefectProcedureID": $('#责任工序').val() == "" ? null : $('#责任工序').val(),
- "DefectProcedureCode": $('#责任工序').val() != "" ? jsonProcedure[$('#责任工序').get(0).selectedIndex - 1]["DUTYPROCEDURECODE"] : "",
- "DefectProcedureName": $('#责任工序').val() != "" ? $("#责任工序").find("option:selected").text() : "",
- "DefectUserID": $('#责任工序').val() != "" ? jsonProcedure[$('#责任工序').get(0).selectedIndex - 1]["USERID"] : defectUserId,
- "DefectUserCode": $("#责任工号").val(),
- "DefectUserName": $('#责任工序').val() != "" ? jsonProcedure[$('#责任工序').get(0).selectedIndex - 1]["USERNAME"] : "",
- "DefectJobs": $("#责任工种").val(),
- "DefectFine": $("#缺陷扣罚").val(),
- "DefectDeductionNum": $("#扣除数").val(),
- "SpecialDefect": $("#特殊缺陷").val(),
- "IsPDA": "1",
- "DefectResponsibles": defectResponsibles,
- }
- //如果是更新
- if (action == "update") {
- if (jsonProductData["PDADefects"].length > 0)
- productionOne["PDACheckTime"] = jsonProductData["PDADefects"][0]["CheckTime"];
- }
- productionDefects.push(productionOne);
- defectCount++;
- }
- //加载产品缺陷记录从编辑数据
- function productDefectLoadJson(json) {
- console.log(json);
- //定义缺陷责任
- var defectResponsibles = [];
- for (var i = 0; i < json["PDADefectResponsibles"].length; i++) {
- var defectOne = {
- "UserID": json["DefectUserID"],
- "UserCode": json["DefectUserCode"],
- "SJobsID": json["PDADefectResponsibles"][i]["SJobsID"],
- "StaffStatus": json["PDADefectResponsibles"][i]["StaffStatus"],
- "StaffID": json["PDADefectResponsibles"][i]["StaffID"],
- "UJobsID": json["PDADefectResponsibles"][i]["UJobsID"],
- //只有编辑时使用
- "PDACheckTime": json["CheckTime"]
- }
- defectResponsibles.push(defectOne);
- }
- //定义缺陷数据
- var productionOne = {
- "DefectID": json["DefectID"],
- "DefectCode": json["DefectCode"],
- "DefectName": json["DefectName"],
- "DefectPositionID": json["DefectPositionID"],
- "DefectPositionCode": json["DefectPositionCode"],
- "DefectPositionName": json["DefectPositionName"],
- "DefectProcedureID": json["DefectProcedureID"],
- "DefectProcedureCode": json["DefectProcedureCode"],
- "DefectProcedureName": json["DefectProcedureName"],
- "DefectUserID": json["DefectUserID"],
- "DefectUserCode": json["DefectUserCode"],
- "DefectUserName": json["DefectUserName"],
- "DefectJobs": json["Jobs"].toString(),
- "DefectFine": json["DefectFineID"],
- "DefectDeductionNum": json["DefectDeductionNum"],
- "SpecialDefect": json["SpecialDefect"],
- "IsPDA": "1",
- "DefectResponsibles": defectResponsibles,
- //只有编辑时使用
- "PDACheckTime": json["CheckTime"]
- }
- productionDefects.push(productionOne);
- defectCount++;
- }
- //获取责任人多选值用|分隔 从当前选项
- function getDefectUserName() {
- var s = $("#责任人").find("option:selected");
- var username = "";
- for (var i = 0; i < s.length; i++) {
- if (i > 0) username += "|";
- username += $("#责任人").find("option:selected")[i].innerText;
- }
- return username;
- }
- //获取责任人多选值用|分隔 从数据
- function getDefectUserNameFromDefect(json) {
- var username = "";
- for (var i = 0; i < json["PDADefectResponsibles"].length; i++) {
- if (username != "") username += "|";
- username += json["PDADefectResponsibles"][i]["StaffName"]
- }
- return username;
- }
- //删除缺陷记录按钮处理
- function productDefectDelete(id) {
- swal({
- title: "产品缺陷",
- text: "您确定要删除缺陷记录吗?",
- icon: "warning",
- buttons: true,
- dangerMode: true,
- buttons: ["取消", "确定"]
- }).then((save) => {
- if (save) {
- $('#' + id).remove();
- productionDefects.splice(parseInt(id), 1);
- defectCount--;
- if (defectCount == 0) {
- ClearProductDefectList();
- //更新产品分级保存按钮
- resetSaveButton();
- }
- }
- });
- }
- //选择缺陷按钮点击处理
- function productDefect_OnClick(id) {
- dialogDefectShow(function () {
- $('#缺陷名称').val(productDefectName);
- loadDefectProcedure();
- $('#产品缺陷保存按钮').prop('disabled', false);
- $('#产品缺陷保存按钮多次').prop('disabled', false);
- });
- }
- //选择缺陷位置按钮点击处理
- function productDefectPosition_OnClick(id) {
- dialogDefectPositionShow(function () {
- $('#缺陷位置').val(productDefectPositionName);
- //loadDefectProcedure();
- //$('#产品缺陷保存按钮').prop('disabled', false);
- //$('#产品缺陷保存按钮多次').prop('disabled', false);
- });
- }
- //保存产品分级
- function productSave() {
- //校验填写数据
- if ($("#产品分级").val() == '') {
- swal({
- title: "产品分级",
- text: "请您选择产品分级!",
- icon: "error",
- button: "确定"
- });
- return;
- }
- if ($("#产品分级").find("option:selected").text() == '正品' && productionDefects.length > 0) {
- swal({
- title: "产品分级",
- text: "产品分级为正品,不能有缺陷记录!",
- icon: "error",
- button: "确定"
- });
- return;
- }
- if ($("#产品分级").find("option:selected").text() != '正品' && productionDefects.length == 0) {
- swal({
- title: "产品分级",
- text: "产品分级为非正品,必须填写缺陷记录!",
- icon: "error",
- button: "确定"
- });
- return;
- }
- if ($("#产品分级").find("option:selected").text() == '重烧' && $("#返工工序").val() == '') {
- swal({
- title: "产品分级",
- text: "请您选择返工工序!",
- icon: "error",
- button: "确定"
- });
- return;
- }
- //保存产品分级 带确认提示
- swal({
- title: "产品分级",
- text: "您确定要保存产品分级数据吗?",
- icon: "warning",
- dangerMode: true,
- buttons: ["取消","确定"]
- }).then((ok) => {
- if (ok) {
- swal({
- title: '产品分级',
- text: '正在保存数据,请稍候。。。',
- icon: 'info',
- button: false,
- closeOnClickOutside: false
- });
- save(ok);
- }
- });
- //保存产品分级 不带确认提示
- //swal("正在保存产品分级...", {
- // buttons: false,
- // timer: 3000,
- //});
- //save(true);
- }
- function save(ok) {
- if (ok) {
- //生成时间戳避免重复提交
- var dataKey = new Date().getTime() + '-' + $('#生产工号').val();
- console.log(dataKey);
- var productionDataEntitys;
- //拼合插入数据
- if (action == "insert") {
- productionDataEntitys = [{
- "DataKey": dataKey,
- "CheckFlag": checkFlag,
- "UserID": jsonUser["userId"],
- "UserCode": jsonUser["userCode"],
- "UserName": jsonUser["userName"],
- "Barcode": $('#产品条码').val(),
- "GoodsLevelID": jsonGoodsLevel[$('#产品分级').get(0).selectedIndex - 1]["DEFECTFLAGID"],
- "GoodsLevelTypeID": jsonGoodsLevel[$('#产品分级').get(0).selectedIndex - 1]["GOODSLEVELTYPEID"],
- "ReworkProcedureID": parseInt($('#返工工序').val()),
- "ReworkProcedureName": $('#返工工序').val() == "" ? "" : $("#返工工序").find("option:selected").text(),
- "DefectFlag": $("#产品分级").find("option:selected").text() == "正品" ? 1 : 2,
- "Remarks": $('#备注').val(),
- "IsPDA": 1,
- "ProductionDefects": productionDefects,
- "OPTimeStampPDA": completeProcedure[0]["CONVERTOPTIMESTAMP"]
- }];
- }
- //拼合更新数据
- if (action == "update") {
- productionDataEntitys = [{
- "DataKey": dataKey,
- "CheckFlag": checkFlag,
- "UserID": jsonUser["userId"],
- "UserCode": jsonUser["userCode"],
- "UserName": jsonUser["userName"],
- "Barcode": $('#产品条码').val(),
- "GoodsLevelID": jsonGoodsLevel[$('#产品分级').get(0).selectedIndex - 1]["DEFECTFLAGID"],
- "GoodsLevelTypeID": jsonGoodsLevel[$('#产品分级').get(0).selectedIndex - 1]["GOODSLEVELTYPEID"],
- "ReworkProcedureID": parseInt($('#返工工序').val()),
- "ReworkProcedureName": $('#返工工序').val() == "" ? "" : $("#返工工序").find("option:selected").text(),
- "DefectFlag": $("#产品分级").find("option:selected").text() == "正品" ? 1 : 2,
- "Remarks": $('#备注').val(),
- "IsPDA": 1,
- "ProductionDefects": productionDefects,
- "OPTimeStampPDA": completeProcedure[0]["CONVERTOPTIMESTAMP"],
- //只有编辑时使用
- "ProductionDataID": productionDataID,
- "PDACheckTime": jsonProductData["CheckTime"],
- "OrgGoodsLevelTypeID": jsonProductData["GoodsLevelTypeID"]
- }];
- }
- //提交到接口
- $.post('api/AddCheckBarcode_WCF.ashx', { 'procedureID': procedureId, 'productionDataEntitys': JSON.stringify(productionDataEntitys) }, function (data) {
- var json = JSON.parse(data);
- if (json['success'] == true) {
- //打印条码
- //if (printBarcode) {
- // if ($("#产品分级").find("option:selected").text() == "正品"
- // || $("#产品分级").find("option:selected").text() == "副品"
- // ) {
- // console.log(jsonGoodsLevel[$('#产品分级').get(0).selectedIndex - 1]["GOODSLEVELTYPEID"]);
- // $("#printBarcode").jqprint({
- // debug: false,
- // importCSS: false,
- // printContainer: false,
- // operaSupport: false
- // });
- // //$("#barcodeImg").print();
- // }
- //}
- //保存成功
- swal({
- title: "产品分级",
- text: '保存成功!',
- icon: "success",
- button: "确定"
- }).then((ok) => {
- $("#产品条码").focus();
- });
- //清空数据,继续下次成检
- resetGoodsGrade(true);
- //产品缺陷列表清空
- ClearProductDefectList();
- }
- else {
- //保存失败
- swal({
- title: "产品分级",
- text: '保存失败!',
- icon: "error",
- button: "确定"
- });
- }
- });
- }
- }
- </script>
- <!--打印条码-->
- <!--<script src="print/jquery.jqprint-0.3.js"></script>-->
- <!--<div id="printBarcode" style="background-color:white;display:none">
- <img id="barcodeImg"/>
- </div>-->
- </body>
- </html>
|