index.html 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  5. <meta http-equiv="Pragma" content="no-cache" />
  6. <meta http-equiv="Expires" content="0" />
  7. <meta charset="utf-8">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  9. <link rel="shortcut icon" href="/img/logo.png" />
  10. <link rel="bookmark" href="/img/logo.png" />
  11. <link rel="stylesheet" href="/plugins/bootstrap-4.3.1/css/bootstrap.min.css">
  12. <link rel="stylesheet" href="/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
  13. <link href="/Plugins/bootstrap-select/css/bootstrap-select.min.css" rel="stylesheet" />
  14. <link rel="stylesheet" href="../common/StyleSheet.css" />
  15. <link href="/Plugins/bootstrap-4.3.1/css/bootstrap4-modal-fullscreen.css" rel="stylesheet" />
  16. <script src="/Plugins/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  17. <script src="/Plugins/virtualkeyboard/xvirtualkeyboard.js"></script>
  18. <style type="text/css">
  19. .nav-link {
  20. padding: .4rem 0.6rem;
  21. }
  22. tr, th, td {
  23. height: 22px !important;
  24. padding: 4px !important;
  25. }
  26. .btn-info:not(:disabled):not(.disabled).active, .btn-info:not(:disabled):not(.disabled):active, .show > .btn-info.dropdown-toggle {
  27. color: #10707f;
  28. /*background-color: #117a8b;*/
  29. background-color: yellow;
  30. /*border-color: #10707f;*/
  31. border-color: yellow;
  32. }
  33. </style>
  34. <title>东科软件</title>
  35. </head>
  36. <body class="bg-light">
  37. <!--导航菜单-->
  38. <script src="../common/navbar.js"></script>
  39. <!--质量登记表单-->
  40. <div class="container-fluid">
  41. <div class="row pt-2">
  42. <div class="col-xl-2"></div>
  43. <div class="col-xl-8 col-lg-12 pt-0 pb-2">
  44. <!--产品分级-->
  45. <div class="rounded bg-white shadow-sm pl-4 pt-3 pr-4 pl-4 pb-2">
  46. <form class="pt-0">
  47. <div class="form-row">
  48. <div class="form-group col-4 mb-1">
  49. <label for="生产工号">生产工号</label>
  50. <input readonly type="text" class="form-control border-secondary" id="生产工号" placeholder="请输入" required>
  51. </div>
  52. <div class="form-group col-4 mb-1">
  53. <label for="产品条码">产品条码</label>
  54. <input value="" onkeydown="if (event.keyCode == 13) loadProduct();" type="text" class="form-control" id="产品条码" placeholder="请输入" required>
  55. <div id="softkeyboard"></div>
  56. </div>
  57. <div class="form-group col-2 align-self-end mb-1">
  58. <button onclick="loadProduct()" id="产品查询" type="button" class="btn btn-info btn-block">产品查询</button>
  59. </div>
  60. <div class="form-group col-1 align-self-end mb-1">
  61. <button onclick="resetGoodsGrade(true)" id="清空条码" type="button" class="btn btn-info btn-block">清空</button>
  62. </div>
  63. <div class="form-group col-1 align-self-end mb-1">
  64. <button onclick="showSop()" id="作业指导书" type="button" class="btn btn-warning btn-block">指导</button>
  65. </div>
  66. </div>
  67. <div class="form-row">
  68. <div class="form-group col-12 mb-1">
  69. <!--<input type="text" class="form-control border-secondary" id="提示信息" placeholder="查询" readonly>-->
  70. <div class="alert alert-info" role="alert" id="提示信息"></div>
  71. </div>
  72. </div>
  73. <div class="form-row">
  74. <div class="form-group col-4 mb-1">
  75. <input type="text" class="form-control border-secondary" id="产品编码" placeholder="产品编码" readonly>
  76. </div>
  77. <div class="form-group col-4 mb-1">
  78. <input type="text" class="form-control border-secondary" id="产品商标" placeholder="产品商标" readonly>
  79. </div>
  80. <div class="form-group col-4 mb-1">
  81. <input type="text" class="form-control border-secondary" id="产品釉料" placeholder="产品釉料" readonly>
  82. </div>
  83. </div>
  84. <div class="form-row">
  85. <div class="form-group col-4">
  86. <input type="text" class="form-control border-secondary" id="漏气" placeholder="漏气" readonly>
  87. </div>
  88. <div class="form-group col-4">
  89. <input type="text" class="form-control border-secondary" id="内漏" placeholder="内漏" readonly>
  90. </div>
  91. <div class="form-group col-4">
  92. <input type="text" class="form-control border-secondary" id="通球" placeholder="通球" readonly>
  93. </div>
  94. </div>
  95. <div class="form-row">
  96. <div class="form-group col-4">
  97. <!--产品分级变量-->
  98. <div style="display:none;">
  99. <label for="产品分级">产品分级</label>
  100. <select id="产品分级" onchange="goodsLevel_OnChange()" class="custom-select" required disabled>
  101. <option value="">请选择...</option>
  102. </select>
  103. </div>
  104. <!--产品分级按钮-->
  105. <div id="产品分级按钮模板" style="display:none;">
  106. <label class="btn btn-info btn-lg active" onclick="goodsLevelSelect('{id}')">
  107. <input type="radio" name="产品分级按钮项" id="产品分级{text}" value="{text}"> {text}
  108. </label>
  109. </div>
  110. <div id="产品分级按钮" class="btn-group btn-group-toggle pt-4" data-toggle="buttons" style="width:100%;">
  111. <label class="btn btn-info btn-lg" onclick="goodsLevelSelect('0')">
  112. <input type="radio" name="产品分级按钮项" id="产品分级正品" value="正品"> 正品
  113. </label>
  114. <label class="btn btn-info btn-lg" onclick="goodsLevelSelect('0')">
  115. <input type="radio" name="产品分级按钮项" id="产品分级副品" value="副品"> 副品
  116. </label>
  117. <label class="btn btn-info btn-lg" onclick="goodsLevelSelect('0')">
  118. <input type="radio" name="产品分级按钮项" id="产品分级重烧" value="重烧"> 重烧
  119. </label>
  120. <label class="btn btn-info btn-lg" onclick="goodsLevelSelect('0')">
  121. <input type="radio" name="产品分级按钮项" id="产品分级次品" value="次品"> 次品
  122. </label>
  123. <label class="btn btn-info btn-lg" onclick="goodsLevelSelect('0')">
  124. <input type="radio" name="产品分级按钮项" id="产品分级次品" value="冷补"> 冷补
  125. </label>
  126. </div>
  127. </div>
  128. <div class="form-group col-4">
  129. <label for="返工工序">返工工序</label>
  130. <select id="返工工序" class="custom-select" required disabled>
  131. <option value="">请选择...</option>
  132. </select>
  133. </div>
  134. <div class="form-group col-1">
  135. <label for="重烧">重烧</label>
  136. <input type="text" class="form-control border-secondary" id="重烧" placeholder="查询" readonly>
  137. </div>
  138. <div class="form-group col-1">
  139. <label for="干补">干补</label>
  140. <input type="text" class="form-control border-secondary" id="干补" placeholder="查询" readonly>
  141. </div>
  142. <div class="form-group col-1">
  143. <label for="冷补">冷补</label>
  144. <input type="text" class="form-control border-secondary" id="冷补" placeholder="查询" readonly>
  145. </div>
  146. </div>
  147. <div class="form-row">
  148. <div class="form-group col-12 align-self-end">
  149. <button onclick="productSave()" id="产品分级保存按钮" type="button" class="btn btn-lg btn-danger btn-block" disabled>保存产品分级</button>
  150. </div>
  151. </div>
  152. </form>
  153. </div>
  154. </div>
  155. <div class="col-xl-2"></div>
  156. </div>
  157. </div>
  158. <!--作业指导书对话框 xuwei add 2022-04-22-->
  159. <div class="modal fade modal-fullscreen" id="sopModal" tabindex="-1" role="dialog" aria-labelledby="sopModalLabel" aria-hidden="true">
  160. <div class="modal-dialog">
  161. <div class="modal-content">
  162. <div class="modal-header">
  163. <h5 class="modal-title" id="mapModalLabel">作业指导书</h5>
  164. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  165. <span aria-hidden="true">&times;</span>
  166. </button>
  167. </div>
  168. <div class="modal-body" style="height:480px;">
  169. <iframe id="sopSrc" src="" width="100%" height="100%" style="border:0px;">
  170. </iframe>
  171. </div>
  172. <div class="modal-footer">
  173. <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. <!--对话框-->
  179. <script src="../common/dialog.js"></script>
  180. <!--版权信息-->
  181. <script src="../common/footer.js"></script>
  182. <script src="/Plugins/bootstrap-4.3.1/js/bootstrap.bundle.min.js"></script>
  183. <script src="/Plugins/bootstrap-select/js/bootstrap-select.min.js"></script>
  184. <script src="/Plugins/sweetalert/sweetalert.min.js"></script>
  185. <script src="/Plugins/xrequest/xrequest.min.js"></script>
  186. <script src="../Common/xuwell.js"></script>
  187. <script>
  188. //xuwei 2020-04-21
  189. //计件标记变量 1新建 2改判 3冷补后
  190. var checkFlag = '1';
  191. //成检工序ID
  192. var procedureId = request('id');
  193. //接口数据源定义
  194. var completeProcedure;
  195. var jsonUser;
  196. var jsonGoodsLevel;
  197. var jsonProcedure;
  198. var jsonStaff;
  199. var defectUserId;
  200. var jsonProductData;
  201. var procedureReFire = [];
  202. var procedureLengbu = [];
  203. var goodsModelForCheck = ""; //物料编码区分大件小件 20230223
  204. //操作方式 insert update
  205. var action = "";
  206. //用于提交的缺陷数据
  207. var productionDefects = [];
  208. var userId = "";
  209. $(document).ready(function () {
  210. //加载数据
  211. loadData();
  212. //加载产品返工工序
  213. $.get('api/GetProductCheckReworkProcedure_WCF.ashx?id=' + procedureId, function (data) {
  214. var returnProcedure = JSON.parse(data);
  215. //20230223 qinqi 多条重烧返工工序数据源
  216. for (var i = 0; i < returnProcedure.rows.length; i++) {
  217. if (returnProcedure.rows[i]["REWORKPROCEDURENAME"].indexOf("重烧") >= 0) {
  218. procedureReFire.push(returnProcedure.rows[i]);
  219. }
  220. else if (returnProcedure.rows[i]["REWORKPROCEDURENAME"].indexOf("冷补") >= 0) {
  221. procedureLengbu.push(returnProcedure.rows[i]);
  222. }
  223. }
  224. //procedureReFire.push(returnProcedure.rows[0]);
  225. //procedureLengbu.push(returnProcedure.rows[1]);
  226. });
  227. });
  228. //产品分级按钮事件
  229. function goodsLevelSelect(value) {
  230. $("#产品分级").val(value);
  231. goodsLevel_OnChange();
  232. }
  233. function keyBoard() {
  234. //加载软键盘
  235. $('#产品条码').keyboard({ usePreview: false, autoAccept: true });
  236. //$('#备注').keyboard({ usePreview: false, autoAccept: true });
  237. swal({
  238. title: '产品分级',
  239. text: '软键盘已加载!',
  240. icon: 'success',
  241. button: '确定'
  242. });
  243. }
  244. //加载 生产工号
  245. function loadData() {
  246. //检查登录状态
  247. $.get('api/LogInCheck_WCF.ashx', function (data) {
  248. var json = JSON.parse(data);
  249. if (json["success"] == true) {
  250. //登录状态
  251. $('#生产工号').val(json["rows"]["userCode"]);
  252. //保存登录数据源
  253. jsonUser = json["rows"];
  254. }
  255. else {
  256. swal({
  257. title: '登录异常!',
  258. text: '请您先登录系统!',
  259. icon: 'error',
  260. button: '确定'
  261. }).then(function () {
  262. window.location = '/main/login/login.html';
  263. });
  264. }
  265. });
  266. //获取工位信息员工信息 2020-07-27 xuwei add
  267. $.get('api/GetWorkStationInfo.ashx', function (data) {
  268. var json = JSON.parse(data);
  269. if (json["success"] == true) {
  270. $('#提示信息').html(json["rows"][0]["WORKSTATIONINFO"]);
  271. }
  272. else {
  273. $('#提示信息').html('数据查询失败!');
  274. }
  275. });
  276. }
  277. //输入条码 加载 产品信息
  278. function loadProduct() {
  279. swal({
  280. title: '产品分级',
  281. text: '正在查询数据,请稍候。。。',
  282. icon: 'info',
  283. button: false,
  284. closeOnClickOutside: false
  285. });
  286. //2020-07-02 重新加载生产工号 并验证登录状态
  287. loadData();
  288. //加载产品信息
  289. $.get('api/GetCheckBarCode_WCF.ashx', { 'procedureid': procedureId, 'barcode': $('#产品条码').val() }, function (data) {
  290. var json = JSON.parse(data);
  291. if (json['success'] == true) {
  292. if (json['rows'][0]['out_errMsg'] == '') {
  293. //通过物料编码后续区分大件小件 20230223
  294. goodsModelForCheck = json['rows'][0]["GOODSMODELforCheck"];
  295. //读取产品信息
  296. $('#产品商标').val('商标:' + json['rows'][0]["out_logoName"]);
  297. $('#产品釉料').val('釉料:' + json['rows'][0]["out_glazeName"]);
  298. $('#产品编码').val('编码:' + json['rows'][0]["out_goodsCode"]);
  299. //$('#产品名称').val('名称:' + json['rows'][0]["out_goodsName"]);
  300. $('#漏气').val('漏气:' + json['rows'][0]["out_LeakFlag1Name"]);
  301. $('#内漏').val('内漏:' + json['rows'][0]["out_LeakFlag2Name"]);
  302. $('#通球').val('通球:' + json['rows'][0]["out_LeakFlag3Name"]);
  303. //设置漏气内漏通球样式 1合格0不合格
  304. $('#漏气').removeClass('bg-info,bg-warning');
  305. $('#内漏').removeClass('bg-info,bg-warning');
  306. $('#通球').removeClass('bg-info,bg-warning');
  307. if (json['rows'][0]["out_LeakFlag1"] == "1") $('#漏气').addClass('bg-info');
  308. if (json['rows'][0]["out_LeakFlag1"] == "0") $('#漏气').addClass('bg-warning');
  309. if (json['rows'][0]["out_LeakFlag2"] == "1") $('#内漏').addClass('bg-info');
  310. if (json['rows'][0]["out_LeakFlag2"] == "0") $('#内漏').addClass('bg-warning');
  311. if (json['rows'][0]["out_LeakFlag3"] == "1") $('#通球').addClass('bg-info');
  312. if (json['rows'][0]["out_LeakFlag3"] == "0") $('#通球').addClass('bg-warning');
  313. $('#重烧').val(json['rows'][0]["out_isReFireName"]);
  314. $('#干补').val(json['rows'][0]["out_specialRepairFlagName"]);
  315. $('#冷补').val(json['rows'][0]["out_lengBuName"]);
  316. //加载完成工序 判断 是 新建 还是 编辑
  317. $.get('api/GetCompleteProcedureIDPDA_WCF.ashx', { 'barcode': $('#产品条码').val() }, function (data) {
  318. var json = JSON.parse(data);
  319. if (json["success"] == true) {
  320. swal.close();
  321. completeProcedure = json["rows"];
  322. //查看是否经过回收工序 判断 checkflag是 1/2 还是 3/4
  323. $.get('api/GetCheckFlag.ashx?m=getCheckFlag', { 'barcode': $('#产品条码').val() }, function (data) {
  324. var json = JSON.parse(data);
  325. if (json["success"] == true) {
  326. if (json["message"] == "1") {
  327. checkFlag = "1";
  328. action = "insert";
  329. loadInsertData();
  330. } else if (json["message"] == "2") {
  331. checkFlag = "2";
  332. action = "update";
  333. loadUpdateData(json["rows"][0]["PRODUCTIONDATAID"]);
  334. } else if (json["message"] == "3") {
  335. checkFlag = "3";
  336. action = "insert";
  337. loadInsertData();
  338. } else if (json["message"] == "4") {
  339. checkFlag = "4";
  340. action = "update";
  341. loadUpdateData(json["rows"][0]["PRODUCTIONDATAID"]);
  342. }
  343. }
  344. //var json = JSON.parse(data);
  345. //if (json["success"] == true) {
  346. //未回收过,checkflag 1/2
  347. //if (json["rows"].length == 0) {
  348. // //查看同一窑车批次是否成检交接过
  349. // $.get('api/GetCheckFlag.ashx?m=checkflag12', { 'barcode': $('#产品条码').val() }, function (data) {
  350. // //未交接过则为1
  351. // if (json["rows"].length == 0) {
  352. // //为空行时是新建
  353. // checkFlag = "1";
  354. // action = "insert";
  355. // loadInsertData();
  356. // }
  357. // //交接过则为2
  358. // else {
  359. // checkFlag = "2";
  360. // action = "update";
  361. // loadUpdateData(json["rows"][0]["PRODUCTIONDATAID"]);
  362. // }
  363. // });
  364. //}
  365. ////回收过,checkflag 3/4
  366. //else {
  367. // var recycleid = json["rows"][0]["PRODUCTIONDATAID"];
  368. // //查看回收后是否成检交接过
  369. // $.get('api/GetCheckFlag.ashx?m=checkflag34', { 'barcode': $('#产品条码').val() }, function (data) {
  370. // //未交接过则为3
  371. // if (json["rows"].length == 0) {
  372. // //为空行时是新建
  373. // checkFlag = "3";
  374. // action = "insert";
  375. // loadInsertData();
  376. // }
  377. // //交接过则为4
  378. // else {
  379. // checkFlag = "4";
  380. // action = "update";
  381. // loadUpdateData(json["rows"][0]["PRODUCTIONDATAID"]);
  382. // }
  383. // });
  384. //}
  385. ////2020-03-23 修正 回收后 再次成检 改判操作 找到正确的成检ID
  386. //$.get('api/GetProductionDataCheckID_WCF.ashx', { 'barcode': $('#产品条码').val() }, function (data) {
  387. // if (data == '{"success":true,"message":"操作成功!","rows":}') {
  388. // data = '{"success":true,"message":"操作成功!","rows":""}';
  389. // }
  390. // var json = JSON.parse(data);
  391. // if (json["success"] == true) {
  392. // //2020-04-23 xuwei 修正
  393. // if (json["rows"].length == 0) {
  394. // //为空行时是新建
  395. // checkFlag = "1";
  396. // action = "insert";
  397. // loadInsertData();
  398. // }
  399. // else {
  400. // if (json["rows"][0]["PROCEDUREID"] == procedureId) {
  401. // //工序相等时是更新
  402. // checkFlag = "2";
  403. // action = "update";
  404. // loadUpdateData(json["rows"][0]["PRODUCTIONDATAID"]);
  405. // }
  406. // else {
  407. // //工序不等时不可到达
  408. // resetGoodsGrade(false);
  409. // swal({
  410. // title: "产品查询",
  411. // text: "该工序不可到达!请确认质量登记工序!",
  412. // icon: "error",
  413. // button: "确定"
  414. // }).then(function () {
  415. // $('#产品条码').val('');
  416. // $('#产品条码').focus();
  417. // });
  418. // }
  419. // }
  420. // }
  421. //});
  422. });
  423. }
  424. });
  425. }
  426. else {
  427. resetGoodsGrade(false);
  428. swal({
  429. title: "产品查询",
  430. text: json['rows'][0]['out_errMsg'],
  431. icon: "error",
  432. button: "确定"
  433. }).then(function () {
  434. //条码无效时清空条码 2020-03-03 xuwei
  435. $('#产品条码').val('');
  436. $('#产品条码').focus();
  437. });
  438. }
  439. }
  440. else {
  441. swal({
  442. title: '登录异常!',
  443. text: '请您重新登录系统!',
  444. icon: 'error',
  445. button: '确定'
  446. }).then(function () {
  447. window.location = '/main/login/login.html';
  448. });
  449. }
  450. });
  451. }
  452. //加载插入数据
  453. function loadInsertData() {
  454. //加载产品分级
  455. xuwell.loadSelect({
  456. id: '#产品分级',
  457. url: 'api/GetProductCheckGoodsGrade_WCF.ashx',
  458. data: {},
  459. fieldKey: 'DEFECTFLAGID',
  460. fieldValue: 'DEFECTFLAGNAME',
  461. onLoad: function (data) {
  462. $('#产品分级').get(0).selectedIndex = 0;
  463. jsonGoodsLevel = data["rows"];
  464. //更新按钮状态
  465. goodsLevel_OnChange();
  466. //加载产品分级按钮
  467. if ($('#产品分级按钮').length > 0) {
  468. $('#产品分级按钮').html('');
  469. for (var i = 0; i < jsonGoodsLevel.length; i++) {
  470. var temp = $('#产品分级按钮模板').html().replaceAll('{id}', data["rows"][i]["DEFECTFLAGID"]).replaceAll('{text}', data["rows"][i]["DEFECTFLAGNAME"]);
  471. temp = temp.replaceAll('active', '');
  472. $('#产品分级按钮').append(temp);
  473. }
  474. }
  475. }
  476. });
  477. //$.get('api/GetProductCheckReworkProcedure_WCF.ashx?id=' + procedureId, function (data) {
  478. // var returnProcedure = JSON.parse(data);
  479. // procedureReFire.push(returnProcedure.rows[0]);
  480. // procedureLengbu.push(returnProcedure.rows[1]);
  481. // //console.log(procedureReFire);
  482. // //console.log(procedureLengbu);
  483. // //$('#返工工序').loadSelectFromData(returnProcedure);
  484. //});
  485. //加载产品返工工序
  486. //xuwell.loadSelect({
  487. // id: '#返工工序',
  488. // url: 'api/GetProductCheckReworkProcedure_WCF.ashx',
  489. // data: { 'id': procedureId },
  490. // fieldKey: 'REWORKPROCEDUREID',
  491. // fieldValue: 'REWORKPROCEDURENAME',
  492. // onLoad: function () {
  493. // $('#返工工序').get(0).selectedIndex = 0;
  494. // }
  495. //});
  496. //备注可用
  497. $('#产品分级').val('');
  498. //$('#备注').prop('disabled', false);
  499. }
  500. //加载编辑数据
  501. function loadUpdateData(productionDataCheckID) {
  502. if (action == "update") {
  503. //读取产品编辑ID
  504. $.get('api/GetProductionData_WCF.ashx', { 'BarCode': $('#产品条码').val(), 'ProcedureID': procedureId, 'userCode': $('#生产工号').val() }, function (data) {
  505. var json = JSON.parse(data);
  506. if (json["success"] == true) {
  507. //记录成检数据ID
  508. if (json["rows"].toString() != "") productionDataID = json["rows"][0]["PRODUCTIONDATAID"];
  509. //xuwei add 2020-03-23 回收后成检数据ID变更
  510. if (productionDataCheckID != 0) productionDataID = productionDataCheckID;
  511. //读取成检数据
  512. $.get('api/GetProductionDataByID_WCF.ashx', { 'productionDataID': productionDataID }, function (data) {
  513. swal.close();
  514. var json = JSON.parse(data);
  515. //读取产品信息 xuwei add 2020-03-23
  516. $('#产品商标').val('商标:' + json["rows"]["PDAProductionData"][0]["LogoName"]);
  517. $('#产品釉料').val('釉料:' + json["rows"]["PDAProductionData"][0]["GlazeName"]);
  518. $('#产品编码').val('编码:' + json["rows"]["PDAProductionData"][0]["GoodsCode"]);
  519. //$('#产品名称').val('名称:' + json["rows"]["PDAProductionData"][0]["GoodsName"]);
  520. //$('#重烧').val(json["rows"]["PDAProductionData"][0]["IsReFireName"]);
  521. //$('#干补').val(json["rows"]["PDAProductionData"][0]["SpecialRepairflagName"]);
  522. if (json["success"] == true) {
  523. //加载产品分级
  524. xuwell.loadSelect({
  525. id: '#产品分级',
  526. url: 'api/GetProductCheckGoodsGrade_WCF.ashx',
  527. data: {},
  528. fieldKey: 'DEFECTFLAGID',
  529. fieldValue: 'DEFECTFLAGNAME',
  530. onLoad: function (data) {
  531. $('#产品分级').val(json["rows"]["PDAProductionData"][0]["DefectFlagID"]);
  532. jsonGoodsLevel = data["rows"];
  533. //加载产品分级按钮
  534. if ($('#产品分级按钮').length > 0) {
  535. $('#产品分级按钮').html('');
  536. for (var i = 0; i < jsonGoodsLevel.length; i++) {
  537. var temp = $('#产品分级按钮模板').html().replaceAll('{id}', data["rows"][i]["DEFECTFLAGID"]).replaceAll('{text}', data["rows"][i]["DEFECTFLAGNAME"]);
  538. if (data["rows"][i]["DEFECTFLAGID"] != json["rows"]["PDAProductionData"][0]["DefectFlagID"])
  539. temp = temp.replaceAll('active', '');
  540. $('#产品分级按钮').append(temp);
  541. }
  542. }
  543. //判定是否超过改判时间
  544. $.get('api/GetSystemSettingDataByCode_WCF.ashx', function (data) {
  545. var json = JSON.parse(data);
  546. if (json["success"] == true) {
  547. var value = json["rows"][0]["SETTINGVALUE"];
  548. //判断是否超过改判时间
  549. //正常 value=0 是不限制 但是按PDA逻辑 使用接口再进行判定
  550. var createTime = jsonProductData["CreateTime"];
  551. $.post('api/BarcodeAllowCancel_WCF.ashx', { 'orgTime': createTime, 'days': value }, function (data) {
  552. var json = JSON.parse(data);
  553. if (json["success"] == true) {
  554. //更新按钮状态
  555. goodsLevel_OnChange();
  556. //2021-06-02 lsq 把这句话注释,和goodsLevel_OnChange()方法互斥
  557. //begin
  558. //$('#产品分级保存按钮').prop('disabled', false);
  559. //end
  560. //$('#备注').prop('disabled', false);
  561. }
  562. //else {
  563. // $('#产品分级').prop("disabled", true);
  564. // $("[delbutton='true']").prop("disabled", true);
  565. // swal({
  566. // title: "产品分级",
  567. // text: "产品已过系统改判时间!",
  568. // icon: "warning",
  569. // button: "确定"
  570. // });
  571. //}
  572. });
  573. }
  574. });
  575. }
  576. });
  577. //加载分级数据
  578. //$('#备注').val(json["rows"]["PDAProductionData"][0]["Remarks"]);
  579. //记录修改数据
  580. jsonProductData = json["rows"]["PDAProductionData"][0];
  581. }
  582. });
  583. }
  584. });
  585. }
  586. }
  587. //产品分级 改变连动处理
  588. function goodsLevel_OnChange() {
  589. if ($("#产品分级").val() != '') {
  590. //重烧能选择返工工序
  591. if ($("#产品分级").find("option:selected").text() == '重烧') {
  592. $('#返工工序').prop('disabled', false);
  593. $('#返工工序').loadSelectFromData(procedureReFire);
  594. //通过物料编码区分大件小件 大件默认重烧工序为:【重烧接收】小件默认:【4-5重烧交接】 20230223
  595. if (goodsModelForCheck.substring(0, 2) == "CT") {
  596. $('#返工工序').val("138");
  597. }
  598. else {
  599. $('#返工工序').val("57");
  600. }
  601. $('#返工工序').prop('disabled', true);
  602. //$('#返工工序').get(0).selectedIndex = 1;
  603. }
  604. //冷补能选择返工工序
  605. else if ($("#产品分级").find("option:selected").text() == '冷补') {
  606. $('#返工工序').prop('disabled', false);
  607. $('#返工工序').loadSelectFromData(procedureLengbu);
  608. $('#返工工序').get(0).selectedIndex = 1;
  609. }
  610. else {
  611. $('#返工工序').prop('disabled', true);
  612. $("#返工工序").val('');
  613. }
  614. //2021-06-02 lsq add 产品编码和产品商标有值时才可以保存
  615. //begin
  616. //读取信息后不可改变产品条码(想改就清空再重新查)
  617. $('#产品条码').attr("readonly", "readonly");
  618. //两种只读写法,容错,防止用户那端不识别
  619. $('#产品条码').attr("readonly", true)
  620. //end1
  621. if ($("#产品编码").val() == '' && $("#产品商标").val() == '') {
  622. $('#产品分级保存按钮').prop('disabled', true);
  623. } else {
  624. $('#产品分级保存按钮').prop('disabled', false);
  625. }
  626. //end2
  627. }
  628. else {
  629. $('#产品分级保存按钮').prop('disabled', true);
  630. }
  631. }
  632. //启用禁用 产品分级 页
  633. function resetGoodsGrade(clearBarCode) {
  634. //产品信息清空
  635. $('#产品商标').val('');
  636. $('#产品釉料').val('');
  637. $('#产品编码').val('');
  638. //$('#产品名称').val('');
  639. $('#重烧').val('');
  640. $('#干补').val('');
  641. //产品分级选项清空禁用
  642. $("#产品分级按钮").children().removeClass("active");
  643. $('#产品分级').val('');
  644. $('#产品分级').prop('disabled', true);
  645. $('#返工工序').val('');
  646. $('#返工工序').prop('disabled', true);
  647. //$('#备注').val('');
  648. //$('#备注').prop('disabled', true);
  649. $('#产品分级保存按钮').prop('disabled', true);
  650. if (clearBarCode) $('#产品条码').val('');
  651. $('#产品条码').attr("readonly", false);
  652. $('#产品条码').focus();
  653. }
  654. //保存产品分级
  655. function productSave() {
  656. //校验填写数据
  657. if ($("#产品分级").val() == '') {
  658. swal({
  659. title: "产品分级",
  660. text: "请您选择产品分级!",
  661. icon: "error",
  662. button: "确定"
  663. });
  664. return;
  665. }
  666. if ($("#产品分级").find("option:selected").text() == '重烧' && $("#返工工序").val() == '') {
  667. swal({
  668. title: "产品分级",
  669. text: "请您选择返工工序!",
  670. icon: "error",
  671. button: "确定"
  672. });
  673. return;
  674. }
  675. if ($("#产品分级").find("option:selected").text() == '冷补' && $("#返工工序").val() == '') {
  676. swal({
  677. title: "产品分级",
  678. text: "请您选择返工工序!",
  679. icon: "error",
  680. button: "确定"
  681. });
  682. return;
  683. }
  684. //保存产品分级 带确认提示
  685. //swal({
  686. // title: "产品分级",
  687. // text: "您确定要保存产品分级数据吗?",
  688. // icon: "warning",
  689. // dangerMode: true,
  690. // buttons: ["取消","确定"]
  691. //}).then((ok) => {
  692. // swal({
  693. // title: '产品分级',
  694. // text: '正在保存数据,请稍候。。。',
  695. // icon: 'info',
  696. // button: false,
  697. // closeOnClickOutside: false
  698. // });
  699. // save(ok);
  700. //});
  701. //保存产品分级 不带确认提示
  702. swal({
  703. title: '产品分级',
  704. text: '正在保存数据,请稍候。。。',
  705. icon: 'info',
  706. button: false,
  707. closeOnClickOutside: false
  708. });
  709. save(true);
  710. }
  711. function save(ok) {
  712. if (ok) {
  713. //生成时间戳避免重复提交
  714. var dataKey = new Date().getTime() + '-' + $('#生产工号').val();
  715. console.log(dataKey);
  716. var productionDataEntitys;
  717. //拼合插入数据
  718. if (action == "insert") {
  719. productionDataEntitys = [{
  720. "DataKey": dataKey,
  721. "CheckFlag": checkFlag,
  722. "UserID": jsonUser["userId"],
  723. "UserCode": jsonUser["userCode"],
  724. "UserName": jsonUser["userName"],
  725. "Barcode": $('#产品条码').val(),
  726. "GoodsLevelID": jsonGoodsLevel[$('#产品分级').get(0).selectedIndex - 1]["DEFECTFLAGID"],
  727. "GoodsLevelTypeID": jsonGoodsLevel[$('#产品分级').get(0).selectedIndex - 1]["GOODSLEVELTYPEID"],
  728. "ReworkProcedureID": parseInt($('#返工工序').val()),
  729. "ReworkProcedureName": $('#返工工序').val() == "" ? "" : $("#返工工序").find("option:selected").text(),
  730. "DefectFlag": $("#产品分级").find("option:selected").text() == "正品" ? 1 : 2,
  731. "Remarks": "",
  732. "IsPDA": 1,
  733. "ProductionDefects": productionDefects,
  734. "OPTimeStampPDA": completeProcedure[0]["CONVERTOPTIMESTAMP"]
  735. }];
  736. }
  737. //拼合更新数据
  738. if (action == "update") {
  739. productionDataEntitys = [{
  740. "DataKey": dataKey,
  741. "CheckFlag": checkFlag,
  742. "UserID": jsonUser["userId"],
  743. "UserCode": jsonUser["userCode"],
  744. "UserName": jsonUser["userName"],
  745. "Barcode": $('#产品条码').val(),
  746. "GoodsLevelID": jsonGoodsLevel[$('#产品分级').get(0).selectedIndex - 1]["DEFECTFLAGID"],
  747. "GoodsLevelTypeID": jsonGoodsLevel[$('#产品分级').get(0).selectedIndex - 1]["GOODSLEVELTYPEID"],
  748. "ReworkProcedureID": parseInt($('#返工工序').val()),
  749. "ReworkProcedureName": $('#返工工序').val() == "" ? "" : $("#返工工序").find("option:selected").text(),
  750. "DefectFlag": $("#产品分级").find("option:selected").text() == "正品" ? 1 : 2,
  751. "Remarks": "",
  752. "IsPDA": 1,
  753. "ProductionDefects": productionDefects,
  754. "OPTimeStampPDA": completeProcedure[0]["CONVERTOPTIMESTAMP"],
  755. //只有编辑时使用
  756. "ProductionDataID": productionDataID,
  757. "PDACheckTime": jsonProductData["CheckTime"],
  758. "OrgGoodsLevelTypeID": jsonProductData["GoodsLevelTypeID"]
  759. }];
  760. }
  761. //提交到接口
  762. $.post('api/AddCheckBarcode_WCF.ashx', { 'procedureID': procedureId, 'productionDataEntitys': JSON.stringify(productionDataEntitys), 'barcode': $('#产品条码').val() }, function (data) {
  763. var json = JSON.parse(data);
  764. if (json['success'] == true) {
  765. //保存成功
  766. //swal({
  767. // title: "产品分级",
  768. // text: '保存成功!',
  769. // icon: "success",
  770. // button: "确定"
  771. //}).then((ok) => {
  772. // $("#产品条码").focus();
  773. //});
  774. //保存成功,自动关闭
  775. swal("保存成功!", {
  776. title: '产品分级',
  777. icon: 'success',
  778. buttons: false,
  779. timer: 2000,
  780. }).then(() => {
  781. $('#产品条码').attr("readonly", false);
  782. $("#产品条码").focus();
  783. });
  784. //清空数据,继续下次成检
  785. resetGoodsGrade(true);
  786. }
  787. else {
  788. if (json['message'] == '重复提交') {
  789. //重复提交不做任何处理 2020-06-28 xuwei
  790. }
  791. else {
  792. //保存失败
  793. swal({
  794. title: "产品分级",
  795. text: '保存失败!' + json['message'],
  796. icon: "error",
  797. button: "确定"
  798. });
  799. }
  800. }
  801. });
  802. }
  803. }
  804. //显示作业指导书 xuwei add 2022-04-22
  805. function showSop() {
  806. //var url = "http://172.18.32.32:9300/upload/blank.pdf";
  807. var barcode = $('#产品条码').val();
  808. if (barcode != null && barcode != "") {
  809. $.post('api/getSopBook.ashx?barcode=' + barcode, function (data) {
  810. if (data != null) {
  811. var json = JSON.parse(data);
  812. if (json != null && json.rows.length > 0) {
  813. $('#sopModal').off('show.bs.modal');
  814. $('#sopModal').on('show.bs.modal', function (event) {
  815. document.getElementById("sopSrc").src = json.rows[0]["URL"];
  816. });
  817. $('#sopModal').off('hide.bs.modal');
  818. $('#sopModal').on('hide.bs.modal', function (event) { });
  819. $('#sopModal').off('click');
  820. $('#sopModal').on('click', function (event) { });
  821. $('#sopModal').modal('show');
  822. } else {
  823. swal({
  824. title: "提示",
  825. text: barcode + '产品条码无作业指导书!',
  826. icon: "error",
  827. button: "确定"
  828. });
  829. }
  830. }
  831. });
  832. } else {
  833. swal({
  834. title: "提示",
  835. text: '请填写产品条码!' ,
  836. icon: "error",
  837. button: "确定"
  838. });
  839. return;
  840. }
  841. }
  842. </script>
  843. </body>
  844. </html>